
- VBA Tutorial
- VBA - Home
- VBA - Overview
- VBA - Excel Macros
- VBA - Excel Terms
- VBA - Macro Comments
- VBA - Message Box
- VBA - Input Box
- VBA - Variables
- VBA - Constants
- VBA - Operators
- VBA - Decisions
- VBA - Loops
- VBA - Strings
- VBA - Date and Time
- VBA - Arrays
- VBA - Functions
- VBA - Sub Procedure
- VBA - Events
- VBA - Error Handling
- VBA - Excel Objects
- VBA - Text Files
- VBA - Programming Charts
- VBA - Userforms
- VBA Useful Resources
- VBA - Quick Guide
- VBA - Useful Resources
- VBA - Discussion
VBA - Time Value Function
The TimeValue Function converts the given input string to a valid time.
Syntax
TimeValue(StringTime)
Example
Add a button and add the following function.
Private Sub Constant_demo_Click() msgbox(TimeValue("20:30")) msgbox(TimeValue("5:15")) msgbox(TimeValue("2:30:58")) End Sub
When you execute the above function, it produces the following output.
8:30:00 PM 5:15:00 AM 2:30:58 AM
vba_date_time.htm
Advertisements