Change a variable every time a variable changes

ineedhalp

New Member
Joined
May 30, 2012
Messages
7
Might be hard to explain but I will try. So I'm doing combinations that consist of 5 things. Now the combinations can easily be done with for and next. BUT I want to write down each different combination in a different column. Now I can't figure this out. Every time an item changes, I want the column to be changed to the next one. My current code looks basically like this:
Code:
For item1 = 2 To itemarv
    For item2 = 2 To itemarv
        For item3 = 2 To itemarv
            For item4 = 2 To itemarv
                For item5 = 2 To itemarv
                Next item5
            Next item4
        Next item3
    Next item2
Next item1
Now how could I make the code change the column variable each time a "next" command is given?
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Sorry, still didn't get it. Column variable isn't included in the code I provided. The point is I have to change a variable every time the "next" command is used.

//Nevermind, got it for real now. No help needed anymore.
 
Upvote 0
Change it to what after which 'next', there are a few 'next' statements.
 
Upvote 0

Forum statistics

Threads
1,211,679
Messages
6,103,245
Members
447,850
Latest member
thebuzzman15

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