Results 1 to 3 of 3
  1. #1
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post
    Hi,

    I created a user form with a Microsoft Date Picker control. My problem is that when I run the form and select a date from the picker control, it returns a time to the spreadsheet. I cannot seem to get it to transfer the date into the cell? What am I missing???

    Here is my tester code...

    Private Sub CommandButton1_Click()
    Unload Me
    Range("A1").Value = Me.DTPicker1.Value
    End Sub
    Regards,
    Rudi

  2. #2
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post
    SOLVED!!!

    One should not unload the form before you collect the value of the date picker.

    This fixes it !! (So simple - )
    Private Sub CommandButton1_Click()
    Range("A1").Value = Me.DTPicker1.Value
    Unload Me
    End Sub
    Regards,
    Rudi

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Yep - "Unload" means "remove from memory", so after that action, the value of a control on the userform is not valid any more.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •