Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default divide and copy rows

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!


  #2   Report Post  
Posted to microsoft.public.excel.programming
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!



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy & divide by Dewayne Excel Discussion (Misc queries) 4 October 23rd 07 10:07 PM
need to divide value across added rows [email protected] Excel Programming 3 August 13th 07 11:28 PM
To take the cells in the same row and divide them in rows [email protected] Excel Discussion (Misc queries) 5 August 11th 07 01:42 PM
Divide Cell Across Rows dee Excel Programming 6 September 26th 06 08:35 AM
I Need to divide all cells in rows 2 and 3 by 100 Brent E Excel Discussion (Misc queries) 3 December 23rd 04 11:27 PM


All times are GMT +1. The time now is 02:13 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"