+ Reply to Thread
Results 1 to 16 of 16

Adding a Calendar to a User Form

  1. #1
    Forum Contributor 00Able's Avatar
    Join Date
    11-17-2010
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    244

    Adding a Calendar to a User Form

    I have a imported a calendar into the VB section of my worksheet. I was hoping I could add it into my Userform, but it is showing up as an independent user form. Was hoping I could have this calendar tie into the date of the userform. Can someone with more programming experience look at this and tell me if this is possible?

    I initially thought it was going to be a no brainer...so much for that...ugh
    Last edited by 00Able; 12-05-2010 at 07:29 PM.

  2. #2
    Forum Contributor
    Join Date
    05-09-2009
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    315

    Re: Adding a Calendar to a User Form

    It would help if you attached your file.

    Basically, you want to add some code to the control on your main form (in the example below it's a textbox called txtChangeDate) on the main form which opens the calendar form (frmCalendar) when you enter it:

    Please Login or Register  to view this content.

    Then add some code to the calendar form so it adds the selected date to the textbox when the calendar is clicked:

    Please Login or Register  to view this content.

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Adding a Calendar to a User Form

    I would steer clear of the activeX controls, see the alternatives in the DatePicker section
    Hope that helps.

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

    Free DataBaseForm example

  4. #4
    Forum Contributor 00Able's Avatar
    Join Date
    11-17-2010
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    244

    Re: Adding a Calendar to a User Form

    Quote Originally Posted by royUK View Post
    I would steer clear of the activeX controls, see the alternatives in the DatePicker section
    I agree with you Roy, and I based on your previous suggestion, I checked out the same site and downloaded a link, I exported a calendar and imported into my worksheet, but I am not sure how to put the two pieces together, I was hoping that when the user clicked on the date field on the userform, the calendar would then pop up to allow them to choose a date, and input the selection into the proper field.

    Is this possible?

  5. #5
    Forum Contributor 00Able's Avatar
    Join Date
    11-17-2010
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    244

    Re: Adding a Calendar to a User Form

    Quote Originally Posted by mojo249 View Post
    It would help if you attached your file.
    I apologize, I did initially attach the file, however, I failed to realize it was to large to attach, I have made the necessary changes and attached it to the first thread now.
    Last edited by 00Able; 11-28-2010 at 12:57 PM.

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Adding a Calendar to a User Form

    Try zipping the file before attaching

  7. #7
    Forum Contributor 00Able's Avatar
    Join Date
    11-17-2010
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    244

    Re: Adding a Calendar to a User Form

    Here is the file, check the code to see where the calendar is
    Last edited by 00Able; 12-05-2010 at 07:29 PM.

  8. #8
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Adding a Calendar to a User Form

    This uses my Calendar Form
    Attached Files Attached Files

  9. #9
    Forum Contributor 00Able's Avatar
    Join Date
    11-17-2010
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    244

    Re: Adding a Calendar to a User Form

    This is excellent, my only question is, How did u make it do that, as this is just a sample file, and I want to add this option to a couple of other forms?

  10. #10
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Adding a Calendar to a User Form

    The codes all there. Just drag & drop all my code to your new workbook.

    Then I added some code to the TextBox to display the Calendar and changed the Tab order of the Controls on your UserForm so that the Date textbox was not selected on initialisation which would have displayed the Calendar.

  11. #11
    Forum Contributor 00Able's Avatar
    Join Date
    11-17-2010
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    244

    Re: Adding a Calendar to a User Form

    ok closing this issue, as that part is fixed but opening a new one that is more relevant..
    Last edited by 00Able; 11-28-2010 at 07:04 PM.

  12. #12
    Forum Contributor
    Join Date
    08-07-2008
    Location
    Australia
    Posts
    132

    Re: Adding a Calendar to a User Form

    Quote Originally Posted by royUK View Post
    The codes all there. Just drag & drop all my code to your new workbook.

    Then I added some code to the TextBox to display the Calendar and changed the Tab order of the Controls on your UserForm so that the Date textbox was not selected on initialisation which would have displayed the Calendar.
    Hi Roy,

    I have tried using the similar code in attached model and am receiving an error. Do you know why this does not work in same manner as your form?

    Thanks
    Attached Files Attached Files

  13. #13
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Adding a Calendar to a User Form

    The only error that I can find is caused by missing named ranges.

    Please Login or Register  to view this content.
    The calendar code works fine

  14. #14
    Forum Contributor
    Join Date
    08-07-2008
    Location
    Australia
    Posts
    132

    Re: Adding a Calendar to a User Form

    Quote Originally Posted by royUK View Post
    The only error that I can find is caused by missing named ranges.

    Please Login or Register  to view this content.
    The calendar code works fine
    royUK

    Not sure I understand how to set those list Names? Could you advise based on my model?

    I am also receiving a "run-time error 424 - Object Required" each time I try to run the script.

    The debugger points to
    Please Login or Register  to view this content.
    Do you know why this is the case and how to fix?

  15. #15
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Adding a Calendar to a User Form

    An alternative in the attachment.
    Attached Files Attached Files



  16. #16
    Registered User
    Join Date
    04-30-2012
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    1

    Re: Adding a Calendar to a User Form

    Quote Originally Posted by royUK View Post
    This uses my Calendar Form
    Amazing, works perfectly - Thank you!!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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