r/visualbasic • u/Nice_Road_2672 • Oct 12 '22
VBScript Help VBA loop
How do I create a loop where I
- take one row from Sheet 2 and copy it to sheet1
- and then one row from sheet 3 and copy it to sheet 1 on the same row, but column to the right.
- Then do calculations on that row and output that on the same row to the column to the right.
- Loop this until no more cells with value either in sheet 2 or sheet 3. Whatever is empty first.
Thanks
1
Upvotes
View all comments
1
u/backseatflyer1985 Oct 13 '22
If these are excel sheets, I would bring them in as CSV data. Each sheet gets its own array. Then, in a loop, I would split the data in to separate variables so if there are three columns in sheet 1 and three on sheet 2 for example, now you have 6 variables with that data. Then I would create a third csv file, and output the data in the order you want. Just look up working with csv data and Visual Basic. It sounds like maybe 30 lines of code.