Hi,
I am formatting time into 24 hour format using a UDF function.
I input start and end times in two cells and they are converted to 24hour format for example 1pm to 13:00.
However, the time 12:00 always appears as 00:05 when I format it to hh:MM format in a different cell rather than remaining as that value.
If I enter 1pm or 2.30pm for example then they convert to 24 hour format fine.
thanks
I am formatting time into 24 hour format using a UDF function.
I input start and end times in two cells and they are converted to 24hour format for example 1pm to 13:00.
However, the time 12:00 always appears as 00:05 when I format it to hh:MM format in a different cell rather than remaining as that value.
If I enter 1pm or 2.30pm for example then they convert to 24 hour format fine.
Code:
Function GetWhen(DateCell As Date, MultipleDaysCell As String, EventStartTimeCell As String, EventEndTimeCell As String, ImportanceCell As Long) As String
Dim EventDate As Date
Dim EventTime As String
Dim When As String
'Get the start and end times
EventTime = "at "
If EventStartTimeCell = "" Then
EventTime = EventTime & "Time TBC"
Else
EventTime = EventTime & Format(EventStartTimeCell, "hh:mm")
End If
If EventEndTimeCell <> "" Then
EventTime = EventTime & " to " & Format(EventEndTimeCell, "hh:mm")
End If
GetWhen = When
End Function
thanks