vba if else
If condition_1 Then
result_1
ElseIf condition_2 Then
result_2
...
ElseIf condition_n Then
result_n
Else
result_else
End If
vba if else
If condition_1 Then
result_1
ElseIf condition_2 Then
result_2
...
ElseIf condition_n Then
result_n
Else
result_else
End If
how to use if condition in time vba
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Range("B:B")) Is Nothing Then
Range("D" & Target.Row) = Date
Range("E" & Target.Row) = Format(Now, "hh:mm:ss")
End If
End Sub
how to use if condition in time vba
If Time > TimeValue("6:30:00") And Time <= TimeValue("14:30:00") Then Range("F" & Target.Row) = "1st Shift"
If Time > TimeValue("14:30:01") And Time <= TimeValue("23:30:00") Then Range("F" & Target.Row) = "2nd Shift"
If Time > TimeValue("23:30:01") And Time <= TimeValue("6:30:00") Then Range("F" & Target.Row) = "Overtime"
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us