Ark68
Well-known Member
- Joined
- Mar 23, 2004
- Messages
- 4,564
- Office Version
- 365
- 2016
- Platform
- Windows
Suppose a user enters a time value in cell C11, 8:25 PM.
In my VBA code, I use the following code to determine the hour and minute components of the entry.
The message box is displaying the hour as 20, which makes sense. The minute is being displayed as 25.
How do I go about rounding mn1 (minutes) up OR down to the nearest quarter hour? In this case, mn1 would change to 30.
In my VBA code, I use the following code to determine the hour and minute components of the entry.
Code:
hr1 = Hour(Range("$C$11"))
mn1 = Minute(Range("$C$11"))
MsgBox "Hour: " & hr1 & " Minute: " & mn1
The message box is displaying the hour as 20, which makes sense. The minute is being displayed as 25.
How do I go about rounding mn1 (minutes) up OR down to the nearest quarter hour? In this case, mn1 would change to 30.