View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default can I use a cell content to auto-populate to a header in excel

You don't type anything into the header.

I provided macros. You choose which one you want to use and run it.

If 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 De Bruin's site on where to store macros.

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.


Gord

On Thu, 18 Jun 2009 06:45:01 -0700, DaveC
wrote:

Gord,

You seem to be the wizard of excel and I appreceate the help. I have tried
to type "ws.Range("A1").Value" exactly into the header box with no success.
This line just appears as the header. Can you tell me what I'm doing wrong or
what exact steps I need to take to make this work. Thanks again.

Dave

"Gord Dibben" wrote:

Sub CellInHeader()
With ActiveSheet
.PageSetup.CenterHeader = .Range("A1").Value
End With
End Sub

Sub CellInHeaderr22()
With ActiveSheet.PageSetup
.LeftHeader = "&""Algerian,Regular""&16" & Range("A1").Value
End With
End Sub

Sub Cell_In_All_Headers()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Sheets
ws.PageSetup.CenterHeader = ws.Range("A1").Value
Next
End Sub


Gord Dibben MS Excel MVP

On Wed, 17 Jun 2009 12:53:01 -0700, DaveC
wrote:

any help on this? I would like to use the contents of a cell to auto-populate
the header. Thanks for any assit.