Date Time Picker Control

jamesperrin1976

New Member
Joined
Feb 8, 2009
Messages
13
I have used a date time picker control on my userform along with a lot of text boxes, combo boxes etc. When I select the OK command button on the form I want to call a macro module to create a table in worksheet 1 of the values selected on the form. I don't have a problem with adding the text box or combo box values to a cell in that table but when i try to set the value of a cell to the date selected in the date time picker control I only get "00-Jan-00" instead of the selected date (I have formatted the cell to show dates as "dd-MMM-yy").

Can anyone help me? I think it might have something to do with passing the date from the form to the module but I don't know enough about VBA to work it out!

For info I am using Excel 2003 and the line in my module to set the cell value to the date time picker control from the form is:

Code:
Cells(7, i).Value = frmWorksOrder.dtpIssueDate.Value

Where "i" is the column number in the loop i am running, frmWorksOrder is the userform and dtpIssueDate is the date time picker control.

Regards,
James
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
jamesperrin1976,

Without seeing more, it is hard to tell.

Try making a "Pubic" variable in your code module for your date picker value.
Then write that variable in your cell.

I'm not sure why the rest of it is working, but by making the date "Public" it may solve your problem.

Gary
 
Upvote 0
Hi Gary,

Thanks for the reply. I have sinced worked out what the problem was and it was nothing to do with the date time picker as such. My user form has 3 pages that are filled in with an OK button at the bottom. The dtp controls are on the first page but the user has to fill in all of the information before pressing OK because I have some code that validates all of the answers. What I found was that the dtp controls did not work unless the form was set back to first page before pressing OK - hence I added some code that did that automatically and everything now works... or that was until I added some more dtp controls to page 3. Now I am stuck again!

James
 
Upvote 0
James,
If you want some help, post what you've got or send me an email through our system and I'll be glad to take a look.

Have spent a bunch of today going back and picking up threads that had not gotten an answer. Just wanted people to know this is a great place to ask...


Gary
 
Upvote 0

Forum statistics

Threads
1,214,954
Messages
6,122,462
Members
449,085
Latest member
ExcelError

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