
- 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 Serial Function
The TimeSerial function returns the time for the specified hour, minute, and second values.
Syntax
TimeSerial(hour,minute,second)
Parameter Description
Hour − A required parameter, which is an integer between 0 and 23 or any numeric expression.
Minute − A required parameter, which is an integer between 0 and 59 or any numeric expression.
Second − A required parameter, which is an integer between 0 and 59 or any numeric expression.
Example
Add a button and add the following function.
Private Sub Constant_demo_Click() msgbox(TimeSerial(20,1,2)) msgbox(TimeSerial(0,59,59)) msgbox(TimeSerial(7*2,60/3,15+3)) End Sub
When you execute the above function, it produces the following output.
8:01:02 PM 12:59:59 AM 2:20:18 PM
vba_date_time.htm
Advertisements