excel - Parsing an array over multiple worksheets -
i trying breakdown array of tickers on 1 sheet multiple sheets. trying loop through multiple sheets using "i" variable both worksheet identifier , multiplier how many tickers go on each sheet.
can spot error i'm making here? or other ways you'd recommend attack this?
"breakdowncount" = user inputted grouping size...in case 200 test.
thanks!
for = 1 breakdowncount upperrange = 8 + (i - 1) * 200 lowerrange = 8 + * 200 msgbox upperrange msgbox lowerrange worksheets("data " & i).range(cells(8, 2), cells(207, 2)).value = worksheets("scanner - all").range(cells(upperrange, 2), cells(lowerrange, 2)).value next
you need qualify all range object parent sheet. includes cells()
inside range():
for = 1 breakdowncount upperrange = 8 + (i - 1) * 200 lowerrange = 8 + * 200 msgbox upperrange msgbox lowerrange worksheets("data " & i).range(worksheets("data " & i).cells(8, 2), worksheets("data " & i).cells(207, 2)).value = worksheets("scanner - all").range(worksheets("scanner - all").cells(upperrange, 2), worksheets("scanner - all").cells(lowerrange, 2)).value next
a little short hand:
dim wsout worksheet worksheets("scanner - all") = 1 breakdowncount set wsout = worksheets("data " & i) upperrange = 8 + (i - 1) * 200 lowerrange = 8 + * 200 msgbox upperrange msgbox lowerrange wsout.range(wsout.cells(8, 2), wsout.cells(207, 2)).value = .range(.cells(upperrange, 2), .cells(lowerrange, 2)).value next end
wiki
Comments
Post a Comment