Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Function myTime(myRng As Range) As String
- Dim Addr As String, sTime As String, eTime As String
- Dim first As Long, last As Long, i As Long
- Addr = myRng.Address
- first = Range(Split(Addr, ":")(0)).Column
- last = Range(Split(Addr, ":")(1)).Column
- If Application.CountA(myRng) = 0 Then
- myTime = ""
- Exit Function
- End If
- For i = first To last
- Select Case UCase(Cells(myRng.Row, i))
- Case "X", "S", "R", "G", "C", "A", "M", "T", "B", "x", "s", "r", "g", "c", "a", "m", "t", "b"
- sTime = Format((i - 3) / 48, "hh:mm")
- Exit For
- End Select
- Next
- For i = last To first Step -1
- Select Case UCase(Cells(myRng.Row, i))
- Case "X", "S", "R", "G", "C", "A", "M", "T", "B", "x", "s", "r", "g", "c", "a", "m", "t", "b"
- eTime = Format((i - 2) / 48, "hh:mm")
- Exit For
- End Select
- Next
- myTime = sTime & " - " & eTime
- End Function
Add Comment
Please, Sign In to add comment