View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Mika Oukka[_2_] Mika Oukka[_2_] is offline
external usenet poster
 
Posts: 8
Default Copy Cells To Another XLS

The previous version one did it to new sheets. This one would distribute to
files.

-Mika

Sub CopyToNewFiles()
Rw = 1
Sheets("Data").Select
Do Until Cells(Rw, 1).Value = ""
Rows(Rw & ":" & Rw + 49).Select
Selection.Copy
Workbooks.Add
Rows("1:1").Select
ActiveSheet.Paste
ActiveWorkbook.SaveAs Filename:="C:\temp\RwsFrom" & Rw & ".xls"
ActiveWorkbook.Close
Rw = Rw + 50
Sheets("Data").Select
Loop
End Sub


"Mika Oukka" wrote in message
i.fi...
Something like this would propably work. If the original Sheet is called
Data so this code would look for an empty cell in column A to stop the
routine.

Sub SplitDataToNewSheets()
Rw = 1
Sheets("Data").Select
Do Until Cells(Rw, 1).Value = ""
Rows(Rw & ":" & Rw + 49).Select
Selection.Copy
Sheets.Add
Rows("1:1").Select
ActiveSheet.Paste
Rw = Rw + 50
Sheets("Data").Select
Loop
End Sub

Regrds, Mika Oukka

"Steve Kennedy" wrote in message
ups.com...
I've been a programmer for 10 years now. This simple thing is kicking
my butt. Any help would be appreciated.

I have a simple Excel file. It is broken up into "chunks", meaning
that every 50 rows is a "chunk". I would like to copy all the data in
each of the 50 rows to a seperate new Excel document. Each 50 rows
would be in its own file. Can someone point me in the right direction?

I would be willing to look at Excel macro code, or stand-alone
application code. Anything.

Thanks,
- Steve