VB Macro Help - Multiple sheets - Export to Seet or File

wmatthai

New Member
Joined
Jul 26, 2010
Messages
4
Hey first off thanks for stopping by.

Requirements: I have two sheets of data. First sheet("SCENARIO") defines the amount of lines needed to replicate, and the data that needs to be replicated. The second sheet("DATA") houses the unique data to UNION to the first sheet. It then needs to spit out that data to the "OUTPUT" sheet.

Example of how each sheet looks/works:

SCENARIO

File Name,MD5_ID,Cnt1,Cnt2,Virtual Users,Iterations,File Copies Count
filename,ea3542917df7ae1693e6a6b0aba211fed8818dd2f4bce634c0339a98b743e65b,37500,2,2,2,2

DATA

UserID,CustomerID,Field1,Field2,Field3,Virtual _User
userID_1,1234567891,Test_TCC1,1234,TEST0002348
userID_2,9999999999,Test_TCC2,9999,TEST0009999
OUTPUT

UserID,CustomerID,Field1,Field2,Field3,MD5_ID,pFileName,Cnt1,Cnt2,Virtual _User

userID_1,1234567891,Test_TCC1,1234,TEST0002348,ea3542917df7ae1693e6a6b0aba211fed8818dd2f4bce634c0339a98b743e65b,filename,37500,1,V1
userID_1,1234567891,Test_TCC1,1234,TEST0002348,ea3542917df7ae1693e6a6b0aba211fed8818dd2f4bce634c0339a98b743e65b,filename,37500,1,V1
userID_2,9999999999,Test_TCC2,9999,TEST0009999,ea3542917df7ae1693e6a6b0aba211fed8818dd2f4bce634c0339a98b743e65b,filename_Copy,37500,1,V2
userID_2,9999999999,Test_TCC2,9999,TEST0009999,ea3542917df7ae1693e6a6b0aba211fed8818dd2f4bce634c0339a98b743e65b,filename_Copy,37500,1,V2


So the UNION seems straight forward, however the kicker is the "Iterations", "Copies", and "Virtual_User" columns.

Iterations = This is the amount of lines it needs to create in the OUTPUT sheet per "Virtual_Users"
Copies = how many times the file needs a copy available to the virtual user to access. So for example each virtual users needs access to its own file, as it needs write access. So VU1 uses "file_name", and VU2 uses "file_name_copy" and so forth. VU1 uses that same file for 2 iterations, and VU2 uses file_name_copy for 2 iterations.
Virtual_User = tag that tells which virtual user uses that row.

what I was starting to do was the following:

For each cell in range of scenario sheet, loop through the amount of iterations, and associate the unique data of sheet "DATA". Then spit that out to a sheet, or if its easier to another file.

Any ideas or some code to get me on the right track?

Thanks!
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

Forum statistics

Threads
1,223,947
Messages
6,175,563
Members
452,652
Latest member
eduedu

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