Moonbeam111
Board Regular
- Joined
- Sep 24, 2018
- Messages
- 73
- Office Version
- 365
- 2010
Good afternoon all
I have this simple watered down code here: (Just for demonstration purposes)
Im confused about it. Basically when I run it, it doesnt test each elseif statement in sequence. Apparently after macro2 is called the code immediately jumps to end if. Is this normal VBA behavior or is something in my code wrong? If not, what workaround is there so that I get each elseif statement tested? I prefer not to use select case if possible.
I have this simple watered down code here: (Just for demonstration purposes)
VBA Code:
If Range("G41") = 'rest of code here' Then
Call macro1
Call macro2
ElseIf Range("G41") = 'rest of code here' then
msgbox 'message here'
ElseIf Range("G41") = 'rest of code here' then
msgbox 'message here'
ElseIf Range("G41") = 'rest of code here' then
Call macro1_alternate
Call macro2_alternate
End If
Im confused about it. Basically when I run it, it doesnt test each elseif statement in sequence. Apparently after macro2 is called the code immediately jumps to end if. Is this normal VBA behavior or is something in my code wrong? If not, what workaround is there so that I get each elseif statement tested? I prefer not to use select case if possible.