ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Page Headings (https://www.excelbanter.com/excel-programming/311756-page-headings.html)

Sheldon

Page Headings
 
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

No Name

Page Headings
 
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.
-----Original Message-----
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
.



All times are GMT +1. The time now is 12:46 PM.

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