ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   I want to incorporate an IF statement in my XL footer (https://www.excelbanter.com/excel-worksheet-functions/153986-i-want-incorporate-if-statement-my-xl-footer.html)

PClantonBailey

I want to incorporate an IF statement in my XL footer
 
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?
--
PClantonBailey

Bob Phillips

I want to incorporate an IF statement in my XL 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)

"PClantonBailey" wrote in message
...
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?
--
PClantonBailey





All times are GMT +1. The time now is 01:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com