Updated header information from cell

B

Breck

I'm new to programming in VBA and I'm using this code to update my sheet
headers automatically

Private Sub worksheet_activate()
ActiveSheet.PageSetup.CenterHeader ="&22 " & Sheet75.Range("B3").Value &
Chr(10) & "&22 " & Range("A1").Value
End Sub


I would like to do modify it to

1. run only if the current CenterHeader has changed or different than the 2
value in the cells that it was created from and
2. get the font size from Sheet75.Range("A3")

I've tried
"If ActiveSheet.PageSetup.CenterHeader <> "&22 " &
Sheet75.Range("CenterHeader").Value & Chr(10) & "&22 " & Range("A1").Value
Then"
for the first one but its not working. And because of the quotes on the font
size putting a range between the quotes doesn't seem to work for the second
one either

Is this possible.

I've searched this forum for more that an hour and can't find anything
similar?

I've also tried using the BeforePrint which worked great when printing just
one sheet at a time. But when I group sheets together and print the grouped
sheets all of the additional sheets have been updated to the
Range("A1").Value from the first sheet of the group and not the A1 cell on
its own sheet. I thought that the before print was the better way to go but
was disappointed that I couldn't get it to work when printing groups of
sheets. Also there are some sheets that I don't want the header updated or
changed so putting that code in thisworkbook doesn't seem to be the way to
go.
 
B

Breck

I figured out the solution to issue 1. , there was a problem with 1
character. Is there a better code solution?

I still haven't found a solution to issue 2 or the beforeprint issue.

Would still love some help.
 
B

Breck

I figured out the solution to issue 1. , there was a problem with 1
character. Is there a better code solution?

I still haven't found a solution to issue 2 or the beforeprint issue.

Would still love some help.
 
B

Breck

I figured out the solution to issue 1. , there was a problem with 1
character. Is there a better code solution?

I still haven't found a solution to issue 2 or the beforeprint issue.

Would still love some help.
 
B

Breck

I figured out the solution to issue 1. , there was a problem with 1
character. Is there a better code solution?

I still haven't found a solution to issue 2 or the beforeprint issue.

Would still love some help.
 
B

Breck

I figured out the solution to issue 1. , there was a problem with 1
character. Is there a better code solution?

I still haven't found a solution to issue 2 or the beforeprint issue.

Would still love some help.
 

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

Top