![]() |
Custom Header - poss to link to contents of cell?
Hi everyone,
Is it possible to use a cell reference in the custom header to pick up info in a cell in the worksheet? TIA -- Smudge |
Custom Header - poss to link to contents of cell?
hi
not sure exactly what you want but i use the following to copy the contents of a cell into the headers and footers Sub HeaderandFooter() Dim s As Integer For s = 1 To Worksheets.Count Worksheets(s).PageSetup.CenterFooter = "&""Arial""&7" & ThisWorkbook.Worksheets("sheet1").Range("E1").Valu e Worksheets(s).PageSetup.LeftHeader = "&""Arial""&7" & ThisWorkbook.Worksheets("sheet1").Range("B1").Valu e ' Worksheets(s).PageSetup.RightHeader = "&""Arial""&7" & ThisWorkbook.Worksheets("sheet1").Range("C1").Valu e Worksheets(s).PageSetup.LeftFooter = "&""Arial""&7" & ThisWorkbook.Worksheets("sheet1").Range("D1").Valu e Worksheets(s).PageSetup.RightFooter = "&""Arial""&7" & ThisWorkbook.Worksheets("sheet1").Range("C1").Valu e ' Worksheets(s).PageSetup.CenterHeader = "&""Arial""&7" & ThisWorkbook.Worksheets("sheet1").Range("F1").Valu e Next s End Sub Paste the code into a macro, type some data into the cells and test the results HTH kevin On 18 Oct, 11:50, Smudge wrote: Hi everyone, Is it possible to use a cell reference in the custom header to pick up info in a cell in the worksheet? TIA -- Smudge |
Custom Header - poss to link to contents of cell?
Sub CellInFooter()
With ActiveSheet .PageSetup.CenterFooter = .Range("A1").Value End With End Sub Gord Dibben MS Excel MVP On Thu, 18 Oct 2007 03:50:02 -0700, Smudge wrote: Hi everyone, Is it possible to use a cell reference in the custom header to pick up info in a cell in the worksheet? TIA |
Custom Header - poss to link to contents of cell?
Hi Kevcar,
Thanks for your reply but I'm obviously missing something as I can't get this to work. Was I supposed to give the workshhet a particular name? Cheers again -- Smudge "kevcar40" wrote: hi not sure exactly what you want but i use the following to copy the contents of a cell into the headers and footers Sub HeaderandFooter() Dim s As Integer For s = 1 To Worksheets.Count Worksheets(s).PageSetup.CenterFooter = "&""Arial""&7" & ThisWorkbook.Worksheets("sheet1").Range("E1").Valu e Worksheets(s).PageSetup.LeftHeader = "&""Arial""&7" & ThisWorkbook.Worksheets("sheet1").Range("B1").Valu e ' Worksheets(s).PageSetup.RightHeader = "&""Arial""&7" & ThisWorkbook.Worksheets("sheet1").Range("C1").Valu e Worksheets(s).PageSetup.LeftFooter = "&""Arial""&7" & ThisWorkbook.Worksheets("sheet1").Range("D1").Valu e Worksheets(s).PageSetup.RightFooter = "&""Arial""&7" & ThisWorkbook.Worksheets("sheet1").Range("C1").Valu e ' Worksheets(s).PageSetup.CenterHeader = "&""Arial""&7" & ThisWorkbook.Worksheets("sheet1").Range("F1").Valu e Next s End Sub Paste the code into a macro, type some data into the cells and test the results HTH kevin On 18 Oct, 11:50, Smudge wrote: Hi everyone, Is it possible to use a cell reference in the custom header to pick up info in a cell in the worksheet? TIA -- Smudge |
Custom Header - poss to link to contents of cell?
Thank you Gord
Cheers -- Smudge "Gord Dibben" wrote: Sub CellInFooter() With ActiveSheet .PageSetup.CenterFooter = .Range("A1").Value End With End Sub Gord Dibben MS Excel MVP On Thu, 18 Oct 2007 03:50:02 -0700, Smudge wrote: Hi everyone, Is it possible to use a cell reference in the custom header to pick up info in a cell in the worksheet? TIA |
Custom Header - poss to link to contents of cell?
Where is this typed into?..... the Header or some other place?
I tried putting it into the header and it returned what I typed. Thanks, Dennis "Gord Dibben" wrote: Sub CellInFooter() With ActiveSheet .PageSetup.CenterFooter = .Range("A1").Value End With End Sub Gord Dibben MS Excel MVP On Thu, 18 Oct 2007 03:50:02 -0700, Smudge wrote: Hi everyone, Is it possible to use a cell reference in the custom header to pick up info in a cell in the worksheet? TIA |
Custom Header - poss to link to contents of cell?
See
http://www.mvps.org/dmcritchie/excel/getstarted.htm In article , DMc wrote: Where is this typed into?..... the Header or some other place? I tried putting it into the header and it returned what I typed. |
Custom Header - poss to link to contents of cell?
Since you're not familiar with VBA and macros, see David McRitchie's site for
more on "getting started". http://www.mvps.org/dmcritchie/excel/getstarted.htm Or Ron de Bruin's site for where to place code. http://www.rondebruin.nl/code.htm In the meantime.......... First...create a backup copy of your original workbook. To create a General Module, hit ALT + F11 to open the Visual Basic Editor. Hit CRTL + r to open Project Explorer. Find your workbook/project and select it. Right-click and InsertModule. Paste the code in there. Save the workbook and hit ALT + Q to return to your workbook. Run or edit the macro by going to ToolMacroMacros. You can also assign this macro to a button or a shortcut key combo or stick it in a BeforePrint event. Gord On Wed, 31 Oct 2007 07:59:01 -0700, DMc wrote: Where is this typed into?..... the Header or some other place? I tried putting it into the header and it returned what I typed. Thanks, Dennis "Gord Dibben" wrote: Sub CellInFooter() With ActiveSheet .PageSetup.CenterFooter = .Range("A1").Value End With End Sub Gord Dibben MS Excel MVP On Thu, 18 Oct 2007 03:50:02 -0700, Smudge wrote: Hi everyone, Is it possible to use a cell reference in the custom header to pick up info in a cell in the worksheet? TIA |
All times are GMT +1. The time now is 11:26 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com