ExcelFunctions.net Logo

The VBA HOUR Function

Home » Excel-VBA-Tutorial » VBA-Operators-And-Functions » VBA-Hour-Function
Search this site:
Custom Search
Related Function: 

Description

The VBA Hour Function returns the hour component of a supplied time. The syntax of the function is:

Hour( time )

Example

A simple example of the VBA Hour function is shown below:

Const CurrTime = "17:56:33"
Dim HourNum As Integer

HourNum = Hour(CurrTime)

After running the above snippet of VBA code, the variable 'HourNum' holds the value 17, which is the hour component of the supplied time "17:56:33".





Valid XHTML 1.0 Transitional
Disclaimer Privacy Policy

Copyright © 2008-2011 ExcelFunctions.net