Page Headings

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have several worksheets in my workbook. I am trying to take a value in one
of the sheets and place it in then center part of the heading in ALL the
worksheets. I have ttrued the following macro, but it doesnt seem to work

strAcctName = Sheet2.Range("G16")
For i = 1 To Sheets.Count
Sheets(i).Select
With ActiveSheet.PageSetup
.CenterHeader = "&""Arial,Italic""Account Name: &""Arial,Bold" &
strAcctName
End With
Next i


Any help would be appreciated.
Thanks
 
hi,
it works if you change it to this
Sub Macro2()

'im strAcctName As Range
Dim i As Integer

'Set strAcctName = Sheet2.Range("G16")
For i = 1 To Sheets.Count
Sheets(i).Select
'With ActiveSheet.PageSetup
' .CenterHeader = ""
'End With
With ActiveSheet.PageSetup
.CenterHeader = "&""Arial,Italic""Account Name:
&""Arial,Bold"" Doda"
' .CenterHeader = Range("G16")
End With
Next i

End Sub
get rid of strAcctName and just put the Acct name in
the .centerheader part. i used acct name doda.
 

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

Back
Top