VBA TIMER Function (Syntax + Example)

Last Updated: June 22, 2023
puneet-gogia-excel-champs

- Written by Puneet

The VBA TIMER function is listed under the time category of VBA functions. When you use it in a VBA code, it returns the number of seconds that have elapsed since midnight of the current day. In simple words, it returns the number of seconds elapsed passed from 12:00 AM of the current day.

Syntax

Timer()

Arguments

  • There’s no argument to specify in this function.

Example

To practically understand how to use the VBA TIMER function, you need to go through the below example where we have written a vba code by using it:

example-vba-timer-function
Sub example_TIMER()
Range("A1").Value = Timer()
End Sub

In the above code, we have used TIMER to get the total seconds that have elapsed since midnight today.