Variable within a variable

austinpcherry

New Member
Joined
Feb 26, 2014
Messages
36
I am setting up a Form in VBA. I have all of my variables and types set properly. The purpose is for units with unique numbers and varying counts.
So item number 100 may be made up of 30 pieces.
I can have multiple unique items per order.
My form gets a total number of items, then asks for each item number, then the count of pieces on each item.
I am using a loop to copy and paste cells for each item onto my printable form. While in my loop I want to call my variables and fill-in the data associated with the variables.
Code:
For j = 1 to (total number of items)
m=11+j *for spacing purposes
Worksheets(reference").range("a12:g12").copy Worksheets(ws.name).range("a1").offset(m,0)
Range(cells(,.5), cells(m,6)).mergecells =true
Next j

What I want to do is to insert a line before the "Next j" that puts the information stored in variables "item1" - "item4" where they exist using the j variable to specify the item#. So itemj, so that it uses the appropriate item# based on which time it copied the reference cells.


How can I do that? Have I coded myself into a corner? Have I set the whole thing up incorrectly?
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
You can put examples of what you have in the userform and what you expect from the result in the sheet.
If you could put images with explanations it would be great.
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,194
Members
452,616
Latest member
intern444

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