JeffGrant
Well-known Member
- Joined
- Apr 7, 2021
- Messages
- 519
- Office Version
- 365
- Platform
- Windows
Hi All, I have an odd one.
This code is part of larger If, Then, Elseif Block.
At this particular ElseIf condition, a sub named SetWeightCalcs is called. The sub returns a Yes/No variable called SetWeightIgnore. The sub is returning the correct value of Yes or No. No problem.
However, regardles of whether I use a Nest If, a Select Case or other various combinations this code ALWAYS terminates the entire If Block. Even in this example where the Case "Yes" only jumps to the next Label100. (whis is over kill for testing purposes).
Please note in this example, the If and End If statments are commented out.
In this particular example, steping through the code successfully goes to Case "Yes", the successfully goes to "Goto Label100", then it jumps to the End If of the entire If block.
I have no idea why.
Can you good folk please help me out with this one.
This code is part of larger If, Then, Elseif Block.
At this particular ElseIf condition, a sub named SetWeightCalcs is called. The sub returns a Yes/No variable called SetWeightIgnore. The sub is returning the correct value of Yes or No. No problem.
However, regardles of whether I use a Nest If, a Select Case or other various combinations this code ALWAYS terminates the entire If Block. Even in this example where the Case "Yes" only jumps to the next Label100. (whis is over kill for testing purposes).
Please note in this example, the If and End If statments are commented out.
In this particular example, steping through the code successfully goes to Case "Yes", the successfully goes to "Goto Label100", then it jumps to the End If of the entire If block.
I have no idea why.
Can you good folk please help me out with this one.
VBA Code:
SetWeightIgnore = "" ' clear the value before entering the sub
Call SetWeightCalcs
'MsgBox SetWeightIgnore
' If SetWeightIgnore <> "Yes" Then
Select Case SetWeightIgnore
Case "No"
Call ResultsN
Call RecordError
Call Skip1
GoTo SubEnd
Case "Yes"
GoTo Label100
' End If
End Select
Label100: