Display cell values in header

lodijanssens

New Member
Joined
Oct 11, 2016
Messages
3
Hi,

I have this VBA to display the cell A1 in the header of the active worksheet. But how do you display the value of cell A1 of sheet 1 in the header of all worksheets?
And how do you display multiple values? For example I want to display A1, B4 and C6 in the header (of the whole workbook).
Thanks a lot!! I'm stuck as a beginner

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
ActiveSheet.PageSetup.LeftFooter = Range("A1").Text
End Sub
 
See if this does what you want it to:

Code:
Private Sub Header_to_sheets()

    Dim ws As Worksheet
    
    For Each ws In ActiveWorkbook.Worksheets
        ws.PageSetup.LeftHeader = Sheet1.Range("A1").Value & " " & Sheet1.Range("B4").Value & " " & Sheet1.Range("C6").Value
    Next ws

End Sub
 
Last edited:
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top