matt beamish
Registered User.
- Local time
- Today, 22:07
- Joined
- Sep 21, 2000
- Messages
- 215
Hello folks.
I am using a little explanation posted by Allen Browne (here http://allenbrowne.com/casu-13.html on expressing minutes as hours and minutes, and I have written this little function:
if my value is negative, I get these results:
TotalMinutes = -500, -8-:20
TotalMinutes = -5, 0-:05
I would like to suppress the negative symbol for the minutes and always show it for the hours, even if the hours are 0, so text boxes display -8:20 and -0:05 respectively.
I think this is going to be by using a series of IIfs, but I dont know how best to suppress the negative...multiply it by -1?
Any advice please?
thanks in advance
I am using a little explanation posted by Allen Browne (here http://allenbrowne.com/casu-13.html on expressing minutes as hours and minutes, and I have written this little function:
Code:
Function Calc_HrsMins(TotalMinutes As Variant) As Variant
On Error GoTo calc_hrsmins_error
Dim varHours, varMinutes
varHours = Int(TotalMinutes \ 60)
varMinutes = Format([TotalMinutes] Mod 60, "\:00")
Calc_HrsMins = varHours & varMinutes
Exit_Calc_HrsMins:
Exit Function
calc_hrsmins_error:
MsgBox Err.Number & Err.Description
Exit Function
End Function
if my value is negative, I get these results:
TotalMinutes = -500, -8-:20
TotalMinutes = -5, 0-:05
I would like to suppress the negative symbol for the minutes and always show it for the hours, even if the hours are 0, so text boxes display -8:20 and -0:05 respectively.
I think this is going to be by using a series of IIfs, but I dont know how best to suppress the negative...multiply it by -1?
Any advice please?
thanks in advance