calendar active x control

andyjames

Board Regular
Joined
May 15, 2007
Messages
133
I have created a calendar to appear when using another form to obtain a date. How do i transfer the date value from one form to another?

I would usually think that this would be done using ByRef but I am struggling to work out how this would be done.
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Hi Andy

Just pass the value of the calendar to say a textbox on your second userform, something like:

Code:
UserForm2.TextBox1.Value = UserFormCalendar.Value

Depends obviously on what object you are wishing to populate, and also how the calendar is constructed.
 
Upvote 0
Thanks Richard

I am still having trouble with this.
I have a msgbox that shows that a date has been selected

MsgBox Calendar1.Value

but when i use this same variable in my other form it reverts back to the 'opening' date.

Travel_request.deptdate_label = frmCalendar.Calendar1.Value

{where travel_request is one userform and frmCalendar the other}
 
Upvote 0
Thank you Andrew

Unfortunately this didn't work for me.
I don't think I understand modules well enough.

At the moment my main userform has most of the code behind it (and where I have added the 'userform1 module' code).

And the second userform (the calendar) has a little also (which is where I have added the 'userform2 module' code).

I have a single module (which is where I've added the 'general module' code).

I am not sure if i have explained what I have done very well, but have I made an obvious mistake?
 
Upvote 0
Please ignore my previous message.
I have found my error.
This works perfectly.
Thank you very much!!!!
 
Upvote 0

Forum statistics

Threads
1,214,376
Messages
6,119,172
Members
448,870
Latest member
max_pedreira

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