Hi can anyone help me to add the necessary codes that results in displaying the time difference in hours?
Function FnCDate()
Dim strDiffr
Dim intTime
Dim strTime
intTime = CDate(Left(ActiveWorkbook.Sheets("Sheet4").Cells(y, 8), 11)) 'This is my column which has timings in AM nd PM format
strTime = TimeValue(Now) 'Here is my current time
strDiffr = CDate(strTime) - CDate(intTime) 'calculating the time difference- even if my intTime and strTime are in same format(Both AM or Both PM) for eg intTime= 3:15:00 AM strTime=4:14:00AM It results in 12:59:00 AM, but i want to display this in hours .
MsgBox CDate(intDate)
MsgBox CDate(strTime)
MsgBox CDate(strDiffr) 'whatever the result is i want it to be shown in hours
End Function
Plz help me out in this......!!
Function FnCDate()
Dim strDiffr
Dim intTime
Dim strTime
intTime = CDate(Left(ActiveWorkbook.Sheets("Sheet4").Cells(y, 8), 11)) 'This is my column which has timings in AM nd PM format
strTime = TimeValue(Now) 'Here is my current time
strDiffr = CDate(strTime) - CDate(intTime) 'calculating the time difference- even if my intTime and strTime are in same format(Both AM or Both PM) for eg intTime= 3:15:00 AM strTime=4:14:00AM It results in 12:59:00 AM, but i want to display this in hours .
MsgBox CDate(intDate)
MsgBox CDate(strTime)
MsgBox CDate(strDiffr) 'whatever the result is i want it to be shown in hours
End Function
Plz help me out in this......!!