View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default divide and copy rows

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

--
Regards,
Tom Ogilvy


"glenn" wrote:

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!