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
 

Some videos you may like

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.

Leith Ross

Well-known Member
Joined
Mar 17, 2008
Messages
1,874
Office Version
2010, 2007
Platform
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
75,764
Office Version
365
Platform
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.
 

Subscribe on YouTube

Watch MrExcel Video

Forum statistics

Threads
1,106,562
Messages
5,512,074
Members
408,878
Latest member
stams

This Week's Hot Topics

  • Sort code advice please
    Hi, I have the code below which im trying to edit but getting a little stuck. This was the original code which worked fine,columns A-F would sort...
  • SUMPRODUCT with nested If statement
    Hi everyone, Hope you're all well. I'm hoping someone will be able to point me in the right direction with a problem I'm having with a SUMPRODUCT...
  • VBA - simple sort is killing me!
    Hello all! This should be so easy, but not for me, apparently! I have a table of data that can be of varying lengths and widths. My current macro...
  • Compare Two Lists
    I have two Lists and I need to be able to Identify differences between them. List 100 comes from a workbook - the other is downloaded form the...
  • Formula that deducts points for each code I input.
    I am trying to create a formula that will have each student in my class start at 100 points and then for each code that I enter (PP for Poor...
  • Conditional formatting formula required for day of week and a value
    Hi, I have a really simple spreadsheet where column A is the date, column B is the activity total shown as a number and column C states the day of...
Top