macro with Date and time picker

Linde

Board Regular
Joined
Dec 27, 2007
Messages
72
Hello Everybody,
:confused:
The Date and time Picker 6.0 from microsoft is giving me a hard time. I have some data in an Excel 2003 sheet that I want to work with.

I can save a selected date from the date and time picker (on a form with lot's of other data) in to the sheet using: cells(4,4).value=Dtp1.value. No problem with the new created information.
Now I want to load the data from the excel sheet into the value of the Dtp1.vale.
It won't work, I Used Format(), I tried a date variable but It won't work

Wat am I doing Wrong,
Does enyone now the right way to give Dtp1 the date from the excel 2003 Sheet?

Hope to hear from you soon,

Harm
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

Leith Ross

Well-known Member
Joined
Mar 17, 2008
Messages
1,874
Office Version
  1. 2010
  2. 2007
Platform
  1. Windows
Hello Linde,

I created a UserForm with a DTPicker and a command button. he command button sets the DTPicker to the value in cell "A1" of the ActiveSheet. The code checks if the value is a date before setting the DTPicker control.
Code:
Private Sub CommandButton1_Click()

    With Range("A1")
      If IsDate(.Value) Then DTPicker1.Value = .Value
    End With
    
End Sub
Sincerely,
Leith Ross
 

Linde

Board Regular
Joined
Dec 27, 2007
Messages
72
Hi everyone,

I installed an other version of the date and time picker.
I'm able to change the value of the object. But if I want to manauly adjust the date it keeps it's value.

I Don't understand,
Does enyone have these experience?

Harm
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,298
Office Version
  1. 365
Platform
  1. Windows
Try using DateValue to convert the value in the cell to a 'real' date - it might not be being recognised as one.

That could be because of formatting or other things.
 

Watch MrExcel Video

Forum statistics

Threads
1,133,278
Messages
5,657,817
Members
418,414
Latest member
ECMdusty

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
Top