I don't know that much about writing macro codes. I got this code on the internet, and it puts the header in all of my worksheets. I only want to put it in one "Enter Header Here". I see where in the code it is referencing the entire workbook, but I don't know what to put in to limit to the one worksheet. Can you help please?
Thank you,
toozippy
Sub AddHeaders()
Application.CutCopyMode = True
Dim Counter As Long
Counter = Sheets.Count
For i = 1 To Counter
Sheets("Enter Header Here").Cells(1,1).EntireRow.Copy
Sheets(i).Cells(1, 1).PasteSpecial
Next i
Application.CutCopyMode = False
Dim headers() As Variant
Dim ws As Worksheet
Dim wb As Workbook
Application.ScreenUpdating = False 'turn this offfor the macro to run a little faster
Set wb = ActiveWorkbook
headers() = Array("X1", "X2","X3", "X4", "X5", "X6", _
"X7", "X8","X9", "X10", "X11", "X12")
For Each ws In wb.Sheets
With ws
.Rows(1).Value = "" 'Thiswill clear out row 1
For i = LBound(headers()) ToUBound(headers())
.Cells(1, 1 + i).Value= headers(i)
Next i
.Rows(1).Font.Bold = True
End With
Next ws
<strike></strike>
Thank you,
toozippy
Sub AddHeaders()
Application.CutCopyMode = True
Dim Counter As Long
Counter = Sheets.Count
For i = 1 To Counter
Sheets("Enter Header Here").Cells(1,1).EntireRow.Copy
Sheets(i).Cells(1, 1).PasteSpecial
Next i
Application.CutCopyMode = False
Dim headers() As Variant
Dim ws As Worksheet
Dim wb As Workbook
Application.ScreenUpdating = False 'turn this offfor the macro to run a little faster
Set wb = ActiveWorkbook
headers() = Array("X1", "X2","X3", "X4", "X5", "X6", _
"X7", "X8","X9", "X10", "X11", "X12")
For Each ws In wb.Sheets
With ws
.Rows(1).Value = "" 'Thiswill clear out row 1
For i = LBound(headers()) ToUBound(headers())
.Cells(1, 1 + i).Value= headers(i)
Next i
.Rows(1).Font.Bold = True
End With
Next ws
<strike></strike>