Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Omar Raffi
 
Posts: n/a
Default cut and paste...but automatic!!!


hello,

i have a number of rows (around 2k) with data in columns.
due to work needed, i need that each sheet contains no more than 50 rows.

solutions:
- i i'll manually cut and copy all rows till they will be no more that 50
per sheet
- i find an automatic way to perform the same

anybdy can help me in this??


  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default

Maybe something like:

Option Explicit
Sub testme01()

Dim wks As Worksheet
Dim newWks As Worksheet
Dim iRow As Long
Dim FirstRow As Long
Dim LastRow As Long
Dim myStep As Long

Set wks = Worksheets("Sheet1")

myStep = 50

With wks
FirstRow = 1
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row

For iRow = FirstRow To LastRow Step myStep
Set newWks = Worksheets.Add
.Rows(iRow).Resize(myStep).Copy _
Destination:=newWks.Range("A1")
Next iRow
End With

End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Omar Raffi wrote:

hello,

i have a number of rows (around 2k) with data in columns.
due to work needed, i need that each sheet contains no more than 50 rows.

solutions:
- i i'll manually cut and copy all rows till they will be no more that 50
per sheet
- i find an automatic way to perform the same

anybdy can help me in this??


--

Dave Peterson
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



All times are GMT +1. The time now is 05:38 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"