- #1
Saladsamurai
- 3,020
- 7
I am learning VBA for Excel and Am just wondering what is wrong with the logic in this statement?
Note that at the present moment, Time < 0.5 , but my program is outputting "Good Evening"
Note that at the present moment, Time < 0.5 , but my program is outputting "Good Evening"
Code:
Sub Better_Nested_If()
Dim Msg As String
If Time < 0.5 Then Msg = "Mornin'" Else
If Time >= 0.5 And Time < 0.75 Then Msg = "Afternoon" _
Else: Msg = "Evening"
MsgBox "Good " & Msg & "!"
End Sub