Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Updating Header Information via VBA

Hi:

I'm trying to update all the worksheet headers in a big SS at once via
VBA. I want to pull a value (a name) from a cell and have it update
the worksheet headers but I'm having problems with the following
argument:

..CenterHeader = "&""Microsoft Sans Serif,Regular""&14" &
..Range("name").Value

The entire command is as follows:

Sub InsertHeaderFooter()
' inserts the same header/footer in all worksheets
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In ActiveWorkbook.Worksheets
Application.StatusBar = "Changing header/footer in " & ws.Name
With ws.PageSetup
.LeftHeader = "&""Microsoft Sans Serif,Regular""&14" &
"Test Header"
.CenterHeader = "&""Microsoft Sans Serif,Regular""&14" &
..Range("name").Value
.RightHeader = "&""Microsoft Sans Serif,Regular""&14" &
"&D"
.CenterFooter = "&""Microsoft Sans Serif,Regular""&10" &
"Page &"
End With
Next ws
Set ws = Nothing
Application.StatusBar = False
End Sub

I've also tried:

..CenterHeader = "&""Microsoft Sans Serif,Regular""&14" & "f13" where
f13 is the cell with the name listed in it).

Any help would be appreciated.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default Updating Header Information via VBA

It should work just fine. What specific "problems" are you having with it?

--

Vasant

"Brock" wrote in message
om...
Hi:

I'm trying to update all the worksheet headers in a big SS at once via
VBA. I want to pull a value (a name) from a cell and have it update
the worksheet headers but I'm having problems with the following
argument:

.CenterHeader = "&""Microsoft Sans Serif,Regular""&14" &
.Range("name").Value

The entire command is as follows:

Sub InsertHeaderFooter()
' inserts the same header/footer in all worksheets
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In ActiveWorkbook.Worksheets
Application.StatusBar = "Changing header/footer in " & ws.Name
With ws.PageSetup
.LeftHeader = "&""Microsoft Sans Serif,Regular""&14" &
"Test Header"
.CenterHeader = "&""Microsoft Sans Serif,Regular""&14" &
.Range("name").Value
.RightHeader = "&""Microsoft Sans Serif,Regular""&14" &
"&D"
.CenterFooter = "&""Microsoft Sans Serif,Regular""&10" &
"Page &"
End With
Next ws
Set ws = Nothing
Application.StatusBar = False
End Sub

I've also tried:

.CenterHeader = "&""Microsoft Sans Serif,Regular""&14" & "f13" where
f13 is the cell with the name listed in it).

Any help would be appreciated.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Updating Header Information via VBA

Does every sheet have a range named "name" - a worksheet level name. If
not, you should not qualify it with the worksheet name



.CenterHeader = "&""MS Sans Serif,Regular""&14" & Range("Name").Value

or at the start

sName = Range("Name").Value

Loop . . .

.CenterHeader = "&""MS Sans Serif,Regular""&14" & sName

End of loop . . .

Otherwise, describe what problem are you having.

--
Regards,
Tom Ogilvy


"Brock" wrote in message
om...
Hi:

I'm trying to update all the worksheet headers in a big SS at once via
VBA. I want to pull a value (a name) from a cell and have it update
the worksheet headers but I'm having problems with the following
argument:

.CenterHeader = "&""Microsoft Sans Serif,Regular""&14" &
.Range("name").Value

The entire command is as follows:

Sub InsertHeaderFooter()
' inserts the same header/footer in all worksheets
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In ActiveWorkbook.Worksheets
Application.StatusBar = "Changing header/footer in " & ws.Name
With ws.PageSetup
.LeftHeader = "&""Microsoft Sans Serif,Regular""&14" &
"Test Header"
.CenterHeader = "&""Microsoft Sans Serif,Regular""&14" &
.Range("name").Value
.RightHeader = "&""Microsoft Sans Serif,Regular""&14" &
"&D"
.CenterFooter = "&""Microsoft Sans Serif,Regular""&10" &
"Page &"
End With
Next ws
Set ws = Nothing
Application.StatusBar = False
End Sub

I've also tried:

.CenterHeader = "&""Microsoft Sans Serif,Regular""&14" & "f13" where
f13 is the cell with the name listed in it).

Any help would be appreciated.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Updating Header Information via VBA


try adding a blank before Range("name").valu

..CenterHeader = "&""Microsoft Sans Serif,Regular""&14" & " " & Range("name").Valu

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Updating Header Information via VBA

I am trying to do the same thing. Here is what I want.

When Text is entered in worksheet 1 A1, I want the text entered int
.CenterHearder of worksheet 3 and 4.


Thanks for the hel

--
Message posted from http://www.ExcelForum.com



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Updating Header Information via VBA

I got this to work. The the benefit of the community, here is the code
After the formatting I had to enter a & and variable without quotes.

Sub ClientName()
Application.ScreenUpdating = False
Dim cName As String
cName = Worksheets("Summary").Range("A1").Value
'Declare string variable for Client Name from Summary Page A1
'
With Worksheets(3).PageSetup
.CenterHeader = "&""Arial,Bold""&12" & cName
"&""Arial,Regular""&10" & Chr(10) & "&""Arial,Bold""&A"
End With
Application.ScreenUpdating = True

End Su

--
Message posted from http://www.ExcelForum.com

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Header Information Belin Excel Worksheet Functions 2 May 29th 10 07:36 PM
Updating Information in all worksheet. SF Excel Discussion (Misc queries) 6 June 2nd 09 06:39 PM
Excel Updating of information [email protected] Excel Worksheet Functions 0 March 5th 08 09:25 AM
Updating the date in Custom Header mjlevie Excel Discussion (Misc queries) 2 June 27th 07 08:54 PM
How do I Freeze information to keep from updating Pete Excel Programming 6 November 26th 03 04:52 PM


All times are GMT +1. The time now is 02:17 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"