ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Use different cell content as headers (https://www.excelbanter.com/excel-discussion-misc-queries/170932-use-different-cell-content-headers.html)

igbert

Use different cell content as headers
 
Would anyone knows how a marco to insert different cell content as header
onto different worksheets within a workbook?


For Example

Sheet 1 : use Cell A1 as header
Sheet 2 : usse Cell F2 as header
Sheet 3 : use Cell M5 as header

Igbert


Bernard Liengme

Use different cell content as headers
 
Try this
Sub Macro1()
With ActiveSheet.PageSetup
.LeftHeader = Range("A1").Value
.CenterHeader = Range("F2").Value
.RightHeader = Range("M5").Value
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
End With
End Sub

If you wish to learn the some basic (forgive the pun) VBA, try using Tools |
Macros | Record Macro
best wishes

--
Bernard V Liengme
Microsoft Excel MVP
www.stfx.ca/people/bliengme
remove caps from email

"igbert" wrote in message
...
Would anyone knows how a marco to insert different cell content as header
onto different worksheets within a workbook?


For Example

Sheet 1 : use Cell A1 as header
Sheet 2 : usse Cell F2 as header
Sheet 3 : use Cell M5 as header

Igbert




Gord Dibben

Use different cell content as headers
 
Not without creating 3 print jobs.

One for each sheet to be printed.


Gord Dibben MS Excel MVP

On Fri, 28 Dec 2007 06:58:02 -0800, igbert
wrote:

Would anyone knows how a marco to insert different cell content as header
onto different worksheets within a workbook?


For Example

Sheet 1 : use Cell A1 as header
Sheet 2 : usse Cell F2 as header
Sheet 3 : use Cell M5 as header

Igbert



igbert

Use different cell content as headers
 
Hi Bernard,

Is there a way to autorun this macro. Also, is it possible to use two cells
content as header? i.e. A1 and A2 for Sheet 1, B3 and B4 for Sheet 2

Thanks

Igbert

"Bernard Liengme" wrote:

Try this
Sub Macro1()
With ActiveSheet.PageSetup
.LeftHeader = Range("A1").Value
.CenterHeader = Range("F2").Value
.RightHeader = Range("M5").Value
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
End With
End Sub

If you wish to learn the some basic (forgive the pun) VBA, try using Tools |
Macros | Record Macro
best wishes

--
Bernard V Liengme
Microsoft Excel MVP
www.stfx.ca/people/bliengme
remove caps from email

"igbert" wrote in message
...
Would anyone knows how a marco to insert different cell content as header
onto different worksheets within a workbook?


For Example

Sheet 1 : use Cell A1 as header
Sheet 2 : usse Cell F2 as header
Sheet 3 : use Cell M5 as header

Igbert






All times are GMT +1. The time now is 12:06 AM.

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