Return to VBA Code Examples

VBA TimeValue Function

TimeValue Description

Returns the serial number of a time.

Simple TimeValue Examples

Here is a simple TimeValue example:

This code will return 6:30:10 AM.

TimeValue Syntax

In the VBA Editor, you can type  “TimeValue(” to see the syntax for the TimeValue Function:

The TimeSerial function contains an argument:

Time: A string of text representing a time (ex. “12:00:00 A.M”).

Examples of Excel VBA TimeValue Function

Result: 6:30:00 AM

Result: 6:30:00 PM

Result: 4:30:15 PM

 

VBA Coding Made Easy

Stop searching for VBA code online. Learn more about AutoMacro - A VBA Code Builder that allows beginners to code procedures from scratch with minimal coding knowledge and with many time-saving features for all users! vba save as


Learn More!