SQUIDD
Well-known Member
- Joined
- Jan 2, 2009
- Messages
- 2,104
- Office Version
- 2019
- 2016
- Platform
- Windows
Hi All
So im wondering how best to tackle this.
Im checking through data and i an checking if scenarios are met.
for example, a very simplified example below.
in fact while writing the example i had a little idea about declaring a global flag status of some description, then if the flag is activate, simple check this at the top of all the check macros, and simply use exit sub
but i still wonder if there is another or better way.
i hope this makes sense, but ultimatly if any of the check subs are unsatisfied, we literally skip to the next A in sub TT
thanks for looking, oh yes, i do not want to write it into 1 sub either and use goto, i have far too many checks to write it that long and confusing.
Dave
So im wondering how best to tackle this.
Im checking through data and i an checking if scenarios are met.
for example, a very simplified example below.
in fact while writing the example i had a little idea about declaring a global flag status of some description, then if the flag is activate, simple check this at the top of all the check macros, and simply use exit sub
but i still wonder if there is another or better way.
i hope this makes sense, but ultimatly if any of the check subs are unsatisfied, we literally skip to the next A in sub TT
thanks for looking, oh yes, i do not want to write it into 1 sub either and use goto, i have far too many checks to write it that long and confusing.
Dave
VBA Code:
Sub TT()
For a = 1 To 100
If b = 1 Then Call check1
If c = 1 Then Call check2
If d = 1 Then Call check3
If e = 1 Then Call check4
If f = 1 Then Call check5
'skip to here if checks not satisfied
Next a
End Sub
Sub check1()
If f = 6 Then 'at this point exit the sub, but also do not action any more of the calls, so next A in sub TT
End Sub
Sub check2()
If f = 6 Then 'at this point exit the sub, but also do not action any more of the calls, so next A in sub TT
End Sub
Sub check3()
If f = 6 Then 'at this point exit the sub, but also do not action any more of the calls, so next A in sub TT
End Sub
Sub check4()
If f = 6 Then 'at this point exit the sub, but also do not action any more of the calls, so next A in sub TT
End Sub
Sub check5()
If f = 6 Then 'at this point exit the sub, but also do not action any more of the calls, so next A in sub TT
End Sub
Sub check6()
If f = 6 Then 'at this point exit the sub, but also do not action any more of the calls, so next A in sub TT
End Sub