Macro - Copy row and paste on all tabs

G

Guest

I'm looking for an easy macro that copies row 4 from sheet1 and pastes data
(column headers) in Row 1 on all the other tabs. The number of tabs
fluctuates.
 
G

Guest

Hi

Dim i As Integer
For i = 2 To Sheets.Count
Sheets("sheet1").Rows(4).Copy Sheets(i).Range("A1")
Next
 
D

Don Guillett

try
Sub copytoall()
For Each ws In Worksheets
Sheets("sheet1").Range("a4:x4").Copy ws.Range("a4")
Next
End Sub
 
G

Guest

Thanks Don, close but not exactly what I'm looking for. I have attemted to
change it around a bit. Here's what I have:

For Each ws In Worksheets
Sheets("sheet1").Range("A1").Select
Selection.End(xlDown).Select
Range(Selection, Selection.End(xlToRight)).Copy ws.Range("A1")
Next


I am having an issue with my code. What I'm trying to do is copy the entire
first row below row A in Sheet1 that has data (my column titles) and paste
these titles on all other tabs in the workbook. Any help would be greatly
appreciated!

Thanks!
 
D

Don Guillett

try

Sub coptoall_Don()'works from anywhere in the workbook.
For Each ws In Worksheets
If ws.Name <> "sheet1" Then _
Sheets("sheet1").Cells(1, 1).End(xlDown). _
EntireRow.Copy ws.Range("a1")
Next ws
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top