I want to incorporate an IF statement in my XL footer

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?
 
B

Bob Phillips

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)
 

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

Similar Threads


Top