VBA TimeValue

TimeValue Function Description

The VBA TimeValue function returns the date variable for a string representing time.

VBA TimeValue Syntax

The syntax for the TimeValue function in VBA is:

TimeValue( time )

Parameters

time
A string representing time e.g. “20:10”, “08:10 PM”

Example usage

The TimeValue function can be used in VBA code. Let’s look at some VBA TimeValue function examples:

TimeValue "20:10"
'Result: 20:10:00 

TimeValue "09:20 PM"
'Result: 21:20:00