Calendar control form? (Saving the value)

Todd_M

Board Regular
Joined
Feb 24, 2002
Messages
117
Hi-
My question concerns how to save the date that was selected by a user using the calendar control form (lets say 7 march 2002).When the user exits the workbook, then reenters the workbook, the calander face resets it self to Dec of 2001. I am looking for a code to write that will have the calendar face stay on march of 2002(or the last date selected) when the workbook is reopened. This can be annoying becouse this workbook is used a few times a day, and each time we open the book, we have to reset the month and the year!
Thankyou if you can suggest something...Todd
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
On 2002-03-07 14:42, Todd_M wrote:
Hi-
My question concerns how to save the date that was selected by a user using the calendar control form (lets say 7 march 2002).When the user exits the workbook, then reenters the workbook, the calander face resets it self to Dec of 2001. I am looking for a code to write that will have the calendar face stay on march of 2002(or the last date selected) when the workbook is reopened. This can be annoying becouse this workbook is used a few times a day, and each time we open the book, we have to reset the month and the year!
Thankyou if you can suggest something...Todd

You can do a few things. Among them:

-Place the last date selected somewhere in your workbook - a hidden sheet, maybe.

-Better yet, make a custom property and use that.

For example, when the form opens

Calendar1.Value = ActiveWorkbook.CustomDocumentProperties("LastDate").Value

And when the user selects a date, add something like this:

ActiveWorkbook.CustomDocumentProperties("LastDate").Value = Calendar1.Value


Hope this helps,

Russell
 
Upvote 0
The easiest way to add a custom document property is to go to File-Properties, then click on the Custom tab. Name the property (in my example, "LastDate" - no quotes), select Date for the type of property, and then put in a value. Then click Add.

-rh
 
Upvote 0
Load the userform containing the control (before using show). You can do this using the open event for the workbook. Then use

Calendar1.Value = Date

This will initialise the calendar to todays date on opening.
 
Upvote 0

Forum statistics

Threads
1,223,516
Messages
6,172,777
Members
452,477
Latest member
DigDug2024

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top