textbox formula outside procedure

  • Thread starter Thread starter bg18461
  • Start date Start date
B

bg18461

I am trying to have a textbox just show todays date. The only problem
am having is having this done outside a procedure. I dont want th
user to have to push a button or select a box, I simply want wheneve
the user opens the workbook, this particular cell to just show today
date. I tried to enter the formula: TextBox18 = Format(Date
"MM/DD/YYYY") in the general portion of of vba sheet (declarations) bu
i get outside procedure compile error, any hints..
 
Try something like in the ThisWorkbook code module:

Sub Workbook_Open()
Worksheets("Sheet1").Textbox18.Value =
Format(Now,"mm/dd/yyyy")
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
Hi
you may have to change the Textbox reference and the sheet reference to
your spreadsheet settings. e.g. change 'Textbox18' to your textbox name
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top