Basic Question - Excel Macro how to Define Range in For, Next

largeselection

Active Member
Joined
Aug 4, 2008
Messages
358
I have some code that I run and a part of it says:
Code:
Do While OX > 0
For g = 08, 11, 14, 17, 20
.
.
.
Next g

So I'm getting an error at the "For g" row because I'm sure I have the construction wrong. So how can I define this range so that it steps through (first g = 8, then at the "next g" it goes to 11").

Or would I put this at the end after the Next. Something like:
Code:
For g = 08 to 20
.
.
.
Next g+3

Sorry I'm new at some of these things. Thanks for your help.
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.

Forum statistics

Threads
1,214,551
Messages
6,120,156
Members
448,948
Latest member
spamiki

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top