PDA

View Full Version : Solved: Add cutom header to Top of printed worksheet



alu
06-18-2007, 07:16 AM
Hi,

I have a workbook that contains several worksheets with data in columns A-N.

The amount of rows varies from sheet to sheet. but up to 100 rows.

I have a custom header that uses A1-N1 on each sheet ("Top Ten = Worksheet name). But if the worksheet has 4 pages my header only appears on the first page.

I would it to appear on all sheets. This is the code I have but I cant work out how to adapt it without producing absolutly tons of VBA using the recorder?!! Thanks all

'Insert Header
Sheets(Array("State 1", "State 2", "State 3", "State 4", _
"State 5", "State 6l")).Select
Sheets("Solutions").Activate
Range("A1").Select
Workbooks.Open FileName:= _
"D:\My Documents\Top States\Header template.xls"
Sheets("Header").Select
Rows("1:1").Select
Selection.Copy
Windows("top ten.xls").Activate
Rows("1:1").Select
Selection.Insert Shift:=xlDown
Range("A1").Select
Sheets("Solutions").Select

lucas
06-18-2007, 07:44 AM
You don't need vba to do this. Go to file-pagesetup. Select the Sheet tab.

Look for rows to repeat at top. Click on the icon on the right end of that dialog and select row 1....done...it should then read $1:$1

alu
06-18-2007, 07:48 AM
Thanks Lucas :bow: