G
Greg Maxey
I have an undetermined number that I need to sequence and do one thing if
the number is:
0, 4, 8, 12
Something else for:
1, 5, 9, 13
Something else for"
2, 6, 10, 14 ...
and finally something else for:
3, 7, 11, 15 ...
I can do that for a limited sized number using Select Case as shown below,
but I don't know how large "i" needs to be. How else could I evaluate i as
it is indexed to see which step count it belongs to? Thanks.
Sub ScratchMacro()
Dim i As Long
For i = 0 To 35
Select Case i
Case 0, 4, 8, 12, 16, 20, 24, 28, 32
MsgBox "Do A"
Case 1, 5, 9, 13, 17, 21, 25, 29, 33
MsgBox "Do B"
Case 2, 6, 10, 14, 18, 22, 26, 30, 34
MsgBox "Do C"
Case 3, 7, 11, 15, 19, 23, 27, 31, 35
MsgBox "Do D"
Case Else
'Do Nothing
End Select
Next i
End Sub
--
Greg Maxey - Word MVP
My web site http://gregmaxey.mvps.org
McCain/Palin '08 !!!
the number is:
0, 4, 8, 12
Something else for:
1, 5, 9, 13
Something else for"
2, 6, 10, 14 ...
and finally something else for:
3, 7, 11, 15 ...
I can do that for a limited sized number using Select Case as shown below,
but I don't know how large "i" needs to be. How else could I evaluate i as
it is indexed to see which step count it belongs to? Thanks.
Sub ScratchMacro()
Dim i As Long
For i = 0 To 35
Select Case i
Case 0, 4, 8, 12, 16, 20, 24, 28, 32
MsgBox "Do A"
Case 1, 5, 9, 13, 17, 21, 25, 29, 33
MsgBox "Do B"
Case 2, 6, 10, 14, 18, 22, 26, 30, 34
MsgBox "Do C"
Case 3, 7, 11, 15, 19, 23, 27, 31, 35
MsgBox "Do D"
Case Else
'Do Nothing
End Select
Next i
End Sub
--
Greg Maxey - Word MVP
My web site http://gregmaxey.mvps.org
McCain/Palin '08 !!!