Quote:
A doubt only, if there is some text in the schedule like for example vacations, appears error 13.
|
Every cell in your schedule is text, even the times are text not real times.
Provided none of your 'for example vacations' have a colon at the third character position this should do it.
Code:
Sub AdvanceTimes_v2()
Dim tmp, cel As Range
Dim firstTime As String
Dim secondTime As String
With Sheets("Sheet1")
For Each cel In .Range("B3:C25")
If InStr(Trim(cel.Value), ":") = 3 Then
tmp = Split(cel.Value, "-")
firstTime = CStr(Format(DateAdd("h", 1, CDate(tmp(0))), "hh:mm"))
secondTime = CStr(Format(DateAdd("h", 1, CDate(tmp(1))), "hh:mm"))
cel.Value = firstTime & "-" & secondTime
End If
Next cel
End With
End Sub
Question... why are you using xls file when your profile indicates Office 2010 64bit ?