G
Guest
I have a macro set up as follows
Public WithEvents App As Application
Private Sub App_WorkbookBeforePrint(ByVal Wb As Workbook, Cancel As Boolean)
CoName = InputBox("Division Name", "Add Division Name to Footer")
Dim finalstring As String
With ActiveSheet.PageSetup
..LeftHeader = ""
..CenterHeader = ""
..RightHeader = ""
..LeftFooter = ""
..CenterFooter = ""
..RightFooter = ""
finalstring = "&8" & CoName
End With
For Each sht In ActiveWorkbook.Sheets
sht.PageSetup.RightFooter = finalstring
sht.PageSetup.CenterFooter = "&8" & "Unaudited - For Management Purposes Only"
Next sht
End Sub
Which this works by bringing up the Input box before I print to insert the
division I am running in the footer, but would like it to automatically place
the division name in the footer based on a formula. For instance CoName = if
cell (a1) = 1 then "TestCo1" if (a1) =2 then "TestCo2" as an example. I
guess I don't know how to make it apply my named based on a condition or
formula.
I hope that makes sense but if you could help me automate this I would
appreciate it
Thanks
Public WithEvents App As Application
Private Sub App_WorkbookBeforePrint(ByVal Wb As Workbook, Cancel As Boolean)
CoName = InputBox("Division Name", "Add Division Name to Footer")
Dim finalstring As String
With ActiveSheet.PageSetup
..LeftHeader = ""
..CenterHeader = ""
..RightHeader = ""
..LeftFooter = ""
..CenterFooter = ""
..RightFooter = ""
finalstring = "&8" & CoName
End With
For Each sht In ActiveWorkbook.Sheets
sht.PageSetup.RightFooter = finalstring
sht.PageSetup.CenterFooter = "&8" & "Unaudited - For Management Purposes Only"
Next sht
End Sub
Which this works by bringing up the Input box before I print to insert the
division I am running in the footer, but would like it to automatically place
the division name in the footer based on a formula. For instance CoName = if
cell (a1) = 1 then "TestCo1" if (a1) =2 then "TestCo2" as an example. I
guess I don't know how to make it apply my named based on a condition or
formula.
I hope that makes sense but if you could help me automate this I would
appreciate it
Thanks