ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   textbox formula outside procedure (https://www.excelbanter.com/excel-programming/299575-textbox-formula-outside-procedure.html)

bg18461[_6_]

textbox formula outside procedure
 
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..

--
Message posted from http://www.ExcelForum.com


Chip Pearson

textbox formula outside procedure
 
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




"bg18461 " wrote in
message ...
I am trying to have a textbox just show todays date. The only

problem i
am having is having this done outside a procedure. I dont want

the
user to have to push a button or select a box, I simply want

whenever
the user opens the workbook, this particular cell to just show

todays
date. I tried to enter the formula: TextBox18 = Format(Date,
"MM/DD/YYYY") in the general portion of of vba sheet

(declarations) but
i get outside procedure compile error, any hints...


---
Message posted from http://www.ExcelForum.com/




bg18461[_7_]

textbox formula outside procedure
 
I get a 'subscript out of range' error.


---
Message posted from http://www.ExcelForum.com/


Frank Kabel

textbox formula outside procedure
 
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

--
Regards
Frank Kabel
Frankfurt, Germany

"bg18461 " schrieb im
Newsbeitrag ...
I get a 'subscript out of range' error.


---
Message posted from http://www.ExcelForum.com/




All times are GMT +1. The time now is 09:24 PM.

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