Prompt user for Customer Name to use info in Header

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all. How can I prompt (on Excel Spreadsheet Load ) a user to enter the
name of a customer and have that customer name appear as part of the text in
the Header (or footer)?

Thanks
 
Private Sub Workbook_Open()
Dim nameit As String
nameit = InputBox("enter a name")
Sheets("Sheet1").PageSetup.CenterFooter = nameit
'or ActiveSheet.PageSetup.CenterFooter = nameit
End Sub


Gord Dibben MS Excel MVP
 
Interesting. I am not getting this to work. I placed the code in the
workbook's VBAProject but it does nothing when I open the workbook. Just a
warning about macros (macro security set to medium--i also set it to low but
nothing still)

when i press 'play >' it works perfectly. what am i missing

thanks,
 
This is event code and goes into Thisworkbook module, not a general module.

With your workbook open, Alt + F11 to go to the VBEditor.

Select your workbook/project and expand by clicking on the "+" sign.

From Microsoft Excel Objects double-clck on ThisWorkbook module to open it.

Paste the code into that module.

Save/close and re-open.


Gord
 
Thank you Gord, I figured it out before I checked back but you answered my
question correctly.
 
Back
Top