Hi All,
I was wondering if anyone could offer some assistance on this problem:
I have one workbook.
The workbook has 20 sheets.
The VBA is placed in the "WorkBork" section.
I only want the VBA to activate on the specific sheets outlined in the code.
The VBA is set to display a center footer with the text in 12 point Verdana
The text displayed is the active sheet name then "My text here" then the value of cell B2 (which is a date)
All the other sheets not listed have specific static headers.
The code works fine when just individual sheets are printed.
When the entire workbook is printed however, the VBA footer from Sheet1 is displayed across all the other sheets footers listed in the code instead of the individual sheet's footer.
Please Help!
Thanks!
Sub Workbook_BeforePrint(Cancel As Boolean)
With Sheet1.PageSetup
.CenterFooter = _
"&12&""Verdana""" & _
ActiveSheet.Name & " My text here " & Range("B2").Text
B2 = Format(Date, " DD MMMM ")
End With
With Sheet5.PageSetup
.CenterFooter = _
"&12&""Verdana""" & _
ActiveSheet.Name & " My text here " & Range("B2").Text
B2 = Format(Date, " DD MMMM ")
End With
With Sheet4.PageSetup
.CenterFooter = _
"&12&""Verdana""" & _
ActiveSheet.Name & " My text here " & Range("B2").Text
B2 = Format(Date, " DD MMMM ")
End With
With Sheet6.PageSetup
.CenterFooter = _
"&12&""Verdana""" & _
ActiveSheet.Name & " My text here " & Range("B2").Text
B2 = Format(Date, " DD MMMM ")
End With
With Sheet8.PageSetup
.CenterFooter = _
"&12&""Verdana""" & _
ActiveSheet.Name & " My text here " & Range("B2").Text
B2 = Format(Date, " DD MMMM ")
End With
With Sheet7.PageSetup
.CenterFooter = _
"&12&""Verdana""" & _
ActiveSheet.Name & " My text here " & Range("B2").Text
B2 = Format(Date, " DD MMMM ")
End With
With Sheet9.PageSetup
.CenterFooter = _
"&12&""Verdana""" & _
ActiveSheet.Name & " My text here " & Range("B2").Text
B2 = Format(Date, " DD MMMM ")
End With
With Sheet10.PageSetup
.CenterFooter = _
"&12&""Verdana""" & _
ActiveSheet.Name & " My text here " & Range("B2").Text
B2 = Format(Date, " DD MMMM ")
End With
With Sheet11.PageSetup
.CenterFooter = _
"&12&""Verdana""" & _
ActiveSheet.Name & " My text here " & Range("B2").Text
B2 = Format(Date, " DD MMMM ")
End With
With Sheet12.PageSetup
.CenterFooter = _
"&12&""Verdana""" & _
ActiveSheet.Name & " My text here " & Range("B2").Text
B2 = Format(Date, " DD MMMM ")
End With
End Sub
Bookmarks