place cell value in header

  • Thread starter Thread starter KHogwood-Thompson
  • Start date Start date
K

KHogwood-Thompson

Hi,

I have a workbook that contains several sheets, in the current setup I have
the [tab] value appearing in the header. What I would like is th value that
is currently in Cell reference "A2" to appear in the header too. To make
things more difficult (as I can do the referencing to cell A2) I would like
the value copied into the header as a paste value type entry, so that when I
delete column A later in the macro the header entry will remain.

Hope this makes sense!
 
Run this macro whenever you wish to capture the value in A2 in the header:

Sub Macro1()
v = Range("A2").Value
ActiveSheet.PageSetup.CenterHeader = v
End Sub
 
Thanks Gary, this works very well I have adapted it so that it can be used on
each worksheet in the workbook, just for anyone else that is interested:

For Each ws In ActiveWorkbook.Worksheets
v = ws.Range("A2").Value
ws.PageSetup.LeftHeader = v
Next

Many thanks again!
--
K Hogwood-Thompson


Gary''s Student said:
Run this macro whenever you wish to capture the value in A2 in the header:

Sub Macro1()
v = Range("A2").Value
ActiveSheet.PageSetup.CenterHeader = v
End Sub

--
Gary''s Student - gsnu200800


KHogwood-Thompson said:
Hi,

I have a workbook that contains several sheets, in the current setup I have
the [tab] value appearing in the header. What I would like is th value that
is currently in Cell reference "A2" to appear in the header too. To make
things more difficult (as I can do the referencing to cell A2) I would like
the value copied into the header as a paste value type entry, so that when I
delete column A later in the macro the header entry will remain.

Hope this makes sense!
 
Back
Top