divide and copy rows

G

glenn

hi all

i have a single worksheet that has let's say 1000 rows

I want to add some VBA that divides the 1000 rows by 10 and copies the
100 groups of rows to either newly created worksheets within the
original workbook or to 100 newly crated single worksheet workbooks.

Where can i find an example?

I guess my pseudo code is

X = 1000/n (n=10)
Create X workbooks
Upper = n
Lower = 1
For Y = 1 to X
Get rows from Lower to Upper and copy them to workbook(y)
Upper = Upper + n
Lower = Lower + n
Next Y

??


Thanks a lot for your help!
 
G

Guest

set sh = Activesheet
for i = 1 to 991 step 10
set rng = sh.Cells(i,1).Resize(10,1).EntireRow
set sh1 = worksheets.Add(after:=Worksheets(worksheets.count))
rng.copy sh1.Range("A1")
' optional
'sh1.move
Next
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top