+ Reply to Thread
Results 1 to 9 of 9

Date Picker from user form

  1. #1
    Forum Contributor
    Join Date
    02-05-2008
    Posts
    116

    Date Picker from user form

    Hi everyone

    I have a calender in userform1, and I want to be able to click on a cell that is formatted to date, then for the calender to appear, then me select a date and for it tobe placed into the selected cell, would anyone be able to help me this code please?

    Many Thanks

    Denzil

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    You can display the form like this

    Please Login or Register  to view this content.
    This line will add the date

    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Contributor
    Join Date
    02-05-2008
    Posts
    116
    Hi Roy

    Thank you very much for your reply, do I just put your code in the the worksheet thats relevent as you sent it to me?

    Right click on the tab and veiw code and place it in there?

    Many thanks again

    Denzil

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    That's correct for the worksheet, the other line needs a button on the form

  5. #5
    Forum Contributor
    Join Date
    02-05-2008
    Posts
    116
    Hi Roy

    Thanks again for your quick response, ive bin playin with the worksheet, and havent had any joy, Ive noticed in the code it has A1, could that be changed to any cell that is date formatted?
    I ran tha code selecting A1 and it has an error and the code stops at the line [QUOTE]If Target.Address = "$A$1" Then formdtp.Show

    Any ideas? have I done something wrong?

    Many Thanks Again

    Denzil

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    You need to edit the code to contain the name of your userform.
    This will check if the cell contains a date or is formatted as a date

    Please Login or Register  to view this content.
    Change the number format to suit your needs

  7. #7
    Forum Contributor
    Join Date
    02-05-2008
    Posts
    116
    Hello Again Roy

    Thank you for all your help, It appears I have to add a date in the cell for the code to work, it doesnt open the calender if the cell is blank, un yet I have formatted the cell as date, is there any way I can change it to open on a blank date formatted cell please??

    Could you explain the button thing you mentioned on the userform that has to be there for the code to put the date in the active cell? is there any way the active cell will show the date of the calender as it is selected, so there is no need to press a button?

    Many Thanks

    Denzil

  8. #8
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Take a look at the code in the Calendar example here

    http://174.133.212.43/showthread.php?t=647642

    The code that I gave you will display the form if either the cell is formatted as d/m, thius you can change, or if the cell already contains a date

  9. #9
    Forum Contributor
    Join Date
    02-05-2008
    Posts
    116
    Hi Roy Thanks for your reply

    That example is exactly how I want it on my worksheet, is it just a case of copying the code?

    MAny Thanks

    Denzil

+ 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