|
-
Oct 21st, 2009, 03:56 PM
#1
Thread Starter
Frenzied Member
For Next - Resolved I reckon
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...
Last edited by Spajeoly; Oct 21st, 2009 at 05:49 PM.
-
Oct 21st, 2009, 04:01 PM
#2
Re: For Next
 Originally Posted by Spajeoly
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...
you can do
For i = 0 To 10
for x = 30 to 45
Waiting for a full featured smart phone with out marrying a provider
Go Android
Go raiders 
-
Oct 21st, 2009, 04:03 PM
#3
Thread Starter
Frenzied Member
Re: For Next
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
Last edited by Spajeoly; Oct 21st, 2009 at 04:07 PM.
-
Oct 21st, 2009, 05:00 PM
#4
Re: For Next
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
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Oct 21st, 2009, 05:10 PM
#5
Re: For Next
Another workable solution:
Code:
For i = 0 to 45
If i = 11 Then i = 30
' ...
Next i
-
Oct 21st, 2009, 05:25 PM
#6
Thread Starter
Frenzied Member
Re: For Next
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.
-
Oct 21st, 2009, 05:42 PM
#7
Re: For Next
AFAIK there is no way to keep them in the same line as you want it....
So Is your query resolved?
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Oct 21st, 2009, 05:48 PM
#8
Thread Starter
Frenzied Member
-
Oct 21st, 2009, 05:53 PM
#9
-
Oct 21st, 2009, 05:56 PM
#10
Re: For Next
 Originally Posted by Spajeoly
I don't know where I thought I had seen this...
Perhaps in Select Case syntax:
Code:
Select Case X
Case 0 To 11, 30 To 45
...
End Select
-
Oct 21st, 2009, 07:26 PM
#11
Re: For Next - Resolved I reckon
Correct, LogoPhobic. The For ... Next coupled with the Select Case ... End Select will work.
-
Oct 22nd, 2009, 12:31 PM
#12
Thread Starter
Frenzied Member
Re: For Next - Resolved I reckon
 Originally Posted by koolsid
Then do remember to mark this thread resolved  Check the link in my signature on how to mark the thread resolved 
I am well aware of the process of editing a thread, I have 2 years on you here after all.
I had marked it resolved before your reply as well, so please do remember to check before commanding.
-
Oct 22nd, 2009, 12:51 PM
#13
Re: For Next - Resolved I reckon
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!).
-
Oct 22nd, 2009, 03:17 PM
#14
Re: For Next - Resolved I reckon
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|