I want to incorporate an IF statement in my XL footer

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

For example, if the value of a certain cell is "X," I want a specific message
to appear in the page footer; otherwise, the message will not appear. How can
I incorporate this IF statement into my footer?
 
Private Sub Workbook_BeforePrint(Cancel As Boolean)
If Worksheets("Sheet1").Range("c1").Value = "X" Then
ActiveSheet.PageSetup.LeftFooter = "My message"
End If
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code

change the range to suit.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
Back
Top