Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. On Jan 20, 7:11*am, "Breck" wrote: 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. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. On Jan 20, 7:11*am, "Breck" wrote: 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. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. On Jan 20, 7:11*am, "Breck" wrote: 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. |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. On Jan 20, 7:11*am, "Breck" wrote: 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. |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. On Jan 20, 7:11*am, "Breck" wrote: 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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Old address information updated to current addressi | Excel Worksheet Functions | |||
Excel cells randomly don't get updated unless each cell is updated | Excel Discussion (Misc queries) | |||
How do I display the last updated date in the page header? | Excel Discussion (Misc queries) | |||
Reacting to updated information | Excel Worksheet Functions | |||
in Excel is it possible to have header information show in a cell | Excel Discussion (Misc queries) |