How to use the VBA TIMER Function (Syntax + Example)

HomeVBA Functions LIST (Category Wise)How to use the VBA TIMER Function (Syntax + Example)

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 VBA TIMER function, you need to go through the below example where we have written a vba code by using it:

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.

Related Functions

HOUR | MINUTE | NOW | SECOND | TIME | TIMESERIAL | TIMEVALUE