+ Reply to Thread
Results 1 to 6 of 6

popup calendar when clicking on cell in userform

  1. #1
    Registered User
    Join Date
    02-21-2013
    Location
    Ontario, Canada
    MS-Off Ver
    Office 2010
    Posts
    96

    popup calendar when clicking on cell in userform

    Hi,

    I found this popup calendar on here a while ago (maybe a month?) that worked great for an application i needed it for. I am now having trouble with it and was hoping someone could shed some light on my problems

    What i have is a userform with 5 textboxes to enter dates in. The calendar pops up for each one however if someone accidentally clicks inside the textbox and wants to his the cancel button or exit it, it clears the date that is currently inside that textbox. This is obviously an issue. I noticed that the value the calendar is pulling is just stored using a tag i am assuming. So if i pick June 14th on the first textbox and then click on the next textbox and just hit cancel on that calendar it will still insert June 14th into the second textbox instead of leaving it alone. Here is all the code relevant to the calendar:

    Class Module:
    Please Login or Register  to view this content.
    Global variables:
    Please Login or Register  to view this content.
    Calendar Form code:
    Please Login or Register  to view this content.
    Code inside each textbox to open calendar:

    Please Login or Register  to view this content.
    Basically all i want is when i Hit the cancel button on the calendar form, i want it to do NOTHING. Any help is appreciated!

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: popup calendar when clicking on cell in userform

    Hello Spritz,

    I understand the code you have posted here. But, there are a few questions I have about your setup that will be answered more quickly and easily by seeing the workbook. Can you post the workbook?
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    02-21-2013
    Location
    Ontario, Canada
    MS-Off Ver
    Office 2010
    Posts
    96

    Re: popup calendar when clicking on cell in userform

    Attached an example workbook. Not sure how this works in Excel 2007.

    You should be able to see what i am talking about here. If you press the button to open up the form and go to the inspections tab, if someone accidentally clicks on the date and they click the x or cancel it removes the date. Similarily, if you accidentally click it and SELECT a date, it keeps that date stored and if you were to click another cell with the calendar in it would replace the current date in there with the date that was stored.
    Attached Files Attached Files

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: popup calendar when clicking on cell in userform

    Hello Spritz,

    Seems like everything breaks at once. Both my truck and my daughter's broke down. I have been juggling schedules with one car to get her to work and back plus deal with the repair shops. Anyway, the attached workbook has a new Calendar. I wrote this a few years ago because I had the same problem you did. This Calendar form will let you select the object the date is to be displayed in. The object must have a Value property for this to work. The reason is most objects have a Value property. There are a few with Captions, TextFrames, etc. That will be an update for a later time.

    The attached workbook has these modules and changes added.
    Here is a sample of the changes I made to your TextBox code. You can see there is far less code now.
    Please Login or Register  to view this content.
    DateBtnEvents - Class Module for the Calendar Date Buttons
    Please Login or Register  to view this content.
    Code for the Calendar Form
    Please Login or Register  to view this content.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    02-21-2013
    Location
    Ontario, Canada
    MS-Off Ver
    Office 2010
    Posts
    96

    Re: popup calendar when clicking on cell in userform

    That's unfortunate to hear about your bad luck
    At least you are pro @ vb :D This is awesome. Thanks Leith!

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: popup calendar when clicking on cell in userform

    Hello Spritz,

    My luck with autos is bad. Thanks for the condolences. Glad to hear you like the changes.

+ 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