+ Reply to Thread
Results 1 to 6 of 6

DTpicker value 0

  1. #1
    Registered User
    Join Date
    10-24-2012
    Location
    Europe
    MS-Off Ver
    Excel 2010
    Posts
    25

    DTpicker value 0

    Hi,

    I have inserted a Date and Time Picker on a userform so that the user can choose a date and then populate it to a cell on a worksheet.

    The code is as follows:

    Private Sub CommandButton1_Click()
    Unload Me
    Dim FechaAsiento As Date
    FechaAsiento = DTPicker1.Value
    Windows(ThisWorkbook.Name).Activate
    Range("D3080") = FechaAsiento
    End Sub

    The problem that I have is that the value entered in D3080 is always zero, no matter what the chosen date is.

    Any help?
    Last edited by shardin; 11-03-2012 at 05:28 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    08-14-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    573

    Re: DTpicker value 0

    Move "Unload Me" before End sub or before activating the sheet. That could be the problem. If this is not solving your problem, Please upload a sample workbook.

  3. #3
    Registered User
    Join Date
    10-24-2012
    Location
    Europe
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: DTpicker value 0

    Well, yes, but the problem is that after the code that I put, there is other part of the code, in which another userform is shown (a progress bar). I have to unload or hide the current form so that the progress bar is shown, otherwise I get error 104 "Can't show a non modal userform while a modal userform is shown. This can be solved however if I change the showmodal property of the main userform to True. But I don't know what consecuences this may have...

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: DTpicker value 0

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  5. #5
    Valued Forum Contributor
    Join Date
    08-14-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    573

    Re: DTpicker value 0

    @Sharin: Have you tested the consequences? Your problem resolved? If not, please add the correct code to find the issue.

  6. #6
    Registered User
    Join Date
    10-24-2012
    Location
    Europe
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: DTpicker value 0

    Well, I've not tested all the consecuences, but it seems that wether you have showmodal true or false it doesn't affect the process in any way.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1