ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to copy rows into worksheets (https://www.excelbanter.com/excel-programming/446614-macro-copy-rows-into-worksheets.html)

cupcakex

Macro to copy rows into worksheets
 
Ill try to explain best I can.

Recently found (finally..) a macro to auto create worksheets named after whats in Column A (5 digit number). I have one master worksheet and now 47 sheets titled with each ID from column A.

Now I have 47 rows with information on the master worksheet and 47 empty worksheets.

How do I put each row into each worksheet? ... Worksheet one will contain row 2, worksheet 2, row 3 etc etc.

I should also mention that row 1 is the header(?) says the titles ...that should be copied in addition to each row.

make sense?

pascal baro

Macro to copy rows into worksheets
 
Hi,
Where in any of the 47 worksheets should rows(2,3,...n) from master sheet be positioned? Second row fixed position I would suppose.
Pascal

cupcakex

Quote:

Originally Posted by pascal baro (Post 1603888)
Hi,
Where in any of the 47 worksheets should rows(2,3,...n) from master sheet be positioned? Second row fixed position I would suppose.
Pascal


Yes 2nd row in each sheet

Claus Busch

Macro to copy rows into worksheets
 
Hi,

Am Tue, 24 Jul 2012 18:55:36 +0000 schrieb cupcakex:

Yes 2nd row in each sheet


following code copies the header and the rows to each sheet:
Sub CopyRows()
Dim i As Integer

With Sheets(1)
For i = 2 To 47
.Rows("1").Copy Destination:=Sheets(i).Range("A1")
.Rows(i).Copy Destination:=Sheets(i).Range("A2")
Next
End With
End Sub


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2

cupcakex

Quote:

Originally Posted by Claus Busch (Post 1603954)
Hi,

Am Tue, 24 Jul 2012 18:55:36 +0000 schrieb cupcakex:

Yes 2nd row in each sheet


following code copies the header and the rows to each sheet:
Sub CopyRows()
Dim i As Integer

With Sheets(1)
For i = 2 To 47
.Rows("1").Copy Destination:=Sheets(i).Range("A1")
.Rows(i).Copy Destination:=Sheets(i).Range("A2")
Next
End With
End Sub


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2


AMAZING!!!! you have saved me so much time thank you x10000000!!


All times are GMT +1. The time now is 11:03 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com