ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   MS Calendar help requested: default to 1st of prior month (https://www.excelbanter.com/excel-programming/301686-ms-calendar-help-requested-default-1st-prior-month.html)

timh2ofall

MS Calendar help requested: default to 1st of prior month
 
Using Calendar in a 97 UserForm to enter dates into a textbox. I want
it to default to the 1st of the previous month on opening.
I tried using the month property set to 0 and then using PreviousMonth
as the Sub but suspect that it won't change after the next month comes
around.
Made a feeble attempt at trying Today -30 just to get to any date last
month.
Any suggestions?
Thanks!
Tim

Rob van Gelder[_4_]

MS Calendar help requested: default to 1st of prior month
 
Calendar1.Value = DateSerial(Year(Date), Month(Date) - 1, 1)

--
Rob van Gelder - http://www.vangelder.co.nz/excel


"timh2ofall" wrote in message
...
Using Calendar in a 97 UserForm to enter dates into a textbox. I want
it to default to the 1st of the previous month on opening.
I tried using the month property set to 0 and then using PreviousMonth
as the Sub but suspect that it won't change after the next month comes
around.
Made a feeble attempt at trying Today -30 just to get to any date last
month.
Any suggestions?
Thanks!
Tim





All times are GMT +1. The time now is 12:36 PM.

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