Isn't there a way to set 2 ranges in a For Next loop?
Say
For i = 0 To 10 AND 30 to 45
I thought it was possible, but I am likely wrong...
Printable View
Isn't there a way to set 2 ranges in a For Next loop?
Say
For i = 0 To 10 AND 30 to 45
I thought it was possible, but I am likely wrong...
One loop, not 2. I think I am just high or something
So basically have I go from 0 To 10 then 30 to 45
If it just that example then you can do something like this.... just a workaround...
vb Code:
Private Sub Sample() Dim i As Long '~~> For i = 0 To 10 AND 30 to 45 For i = 0 To 45 If i < 11 Or i > 29 Then '~~> Your code End If Next i End Sub
Another workable solution:
Code:For i = 0 to 45
If i = 11 Then i = 30
' ...
Next i
Yeah, I reckon I can settle for that.
I don't know where I thought I had seen this but I was obviously just being retroactively mistaken.
AFAIK there is no way to keep them in the same line as you want it....
So Is your query resolved?
Fine
Then do remember to mark this thread resolved :) Check the link in my signature on how to mark the thread resolved ;)
Correct, LogoPhobic. The For ... Next coupled with the Select Case ... End Select will work.
Marking a thread as resolved does not need to involve the effort of editing - and while you have added the word Resolved to the title, it is far from the manner we all expect it, so it is easy to miss (I had to check twice if it was there for koolsid's reply!).
@Spajeoly: I know you have been in the forum much before me but what made you think that I was commanding :) ? It was just a simple polite request ;)
The idea behind marking a thread is to let other members know that your problem is sorted so that they don't waste their time :)