Hi,
Is there a way for me to improve the code below? There are times that I only need to run the command (Time1) 2 or 3 times. Leaving Row A4 and A5 without any date and time value will cause the macro to go to the debug option and the only way for me to proceed is to delete the last 2 lines of the command. What I want to achieve is for the command below to run even there are some cells that does not have any date or time value. Thanks in advance!
"Time1" = a macro command
Column A = Date
Column B = Time
Sub OnTime()
Application.OnTime DateValue(Range("A1").Text) + TimeValue(Range("B1").Text), "Time1"
Application.OnTime DateValue(Range("A2").Text) + TimeValue(Range("B2").Text), "Time1"
Application.OnTime DateValue(Range("A3").Text) + TimeValue(Range("B3").Text), "Time1"
Application.OnTime DateValue(Range("A4").Text) + TimeValue(Range("B4").Text), "Time1"
Application.OnTime DateValue(Range("A5").Text) + TimeValue(Range("B5").Text), "Time1"
End Sub
Is there a way for me to improve the code below? There are times that I only need to run the command (Time1) 2 or 3 times. Leaving Row A4 and A5 without any date and time value will cause the macro to go to the debug option and the only way for me to proceed is to delete the last 2 lines of the command. What I want to achieve is for the command below to run even there are some cells that does not have any date or time value. Thanks in advance!
"Time1" = a macro command
Column A = Date
Column B = Time
Sub OnTime()
Application.OnTime DateValue(Range("A1").Text) + TimeValue(Range("B1").Text), "Time1"
Application.OnTime DateValue(Range("A2").Text) + TimeValue(Range("B2").Text), "Time1"
Application.OnTime DateValue(Range("A3").Text) + TimeValue(Range("B3").Text), "Time1"
Application.OnTime DateValue(Range("A4").Text) + TimeValue(Range("B4").Text), "Time1"
Application.OnTime DateValue(Range("A5").Text) + TimeValue(Range("B5").Text), "Time1"
End Sub