+ Reply to Thread
Results 1 to 10 of 10

Date Picker / Calendar for Combobox

  1. #1
    Registered User
    Join Date
    05-22-2011
    Location
    chennai
    MS-Off Ver
    Excel 2003
    Posts
    71

    Date Picker / Calendar for Combobox

    Hi

    I'm trying to do Date Picker for Combobox - That means when I click the combo box in the the Date picker should appear and NOTE: The Date Picker should be done in VBA code not addition control. I have searched in Web and got one but it was in form and I just required in Combobox Sheet1. - Can you guys help me please.

    Thanks
    Thiru
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Date Picker / Calendar for Combobox

    I have not looked at your code. I have a 'DatePicker' done entirely in VBA in the attached file adapted from another person's original code. The other person did all the HEAVY lifting.

    You should be able to adapt what I've done for your needs. Click on the 'Test Calendar Form Using UserForm1' button in Sheet 'Main' to see the 'DatePicker' in action with a very simple UserForm.

    The function you want to use is 'LjmGetDateUsingCalendarForm()' in module 'ModLJMPicker'. It explains what resources are needed to port the 'DatePicker' to your application.

    Good luck.

    Edit: Added for Lewis - September 2, 2015:
    The file associated with this post can still be used, but is valid for US dates ONLY.
    Attached Files Attached Files
    Last edited by FDibbins; 09-02-2015 at 08:00 PM.

  3. #3
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Date Picker / Calendar for Combobox

    The attached file is an update to the 'Date Picker' code in post #2 which contains the following major changes:
    a. US Date/European Date independence (original was good in US only).
    b. Added arrows to increment/decrement by days or with 'Ctrl key pressed, by months.
    c. Added Query_Close code to return 'None' when 'x' is selected (top right corner of UserForm).
    d. Allows the use of any date as a 'Seed' date. The original could only use the current date as the seed date.

    Lewis
    Attached Files Attached Files
    Last edited by LJMetzger; 09-02-2015 at 07:52 PM.

  4. #4
    Forum Contributor
    Join Date
    10-03-2015
    Location
    Jamaica
    MS-Off Ver
    2013
    Posts
    120

    Re: Date Picker / Calendar for Combobox

    Can you please advise how to update for use on 64bit machine (as seen in pic)

    can you please advise me how to do this
    Attached Images Attached Images

  5. #5
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Date Picker / Calendar for Combobox

    Hi,

    Sorry for the problem with 64 bit. Try replacing the line in red above with the following which should work in both 32 bit and 64 bit Excel:
    Please Login or Register  to view this content.
    I suggest you update your profile to change the office version from '2013' to '64 bit 2013'. This will help you get more accurate responses in the future.

    Lewis

  6. #6
    Forum Contributor
    Join Date
    10-03-2015
    Location
    Jamaica
    MS-Off Ver
    2013
    Posts
    120

    Re: Date Picker / Calendar for Combobox

    Goo Day Sir

    I am trying to adapt the above calendar date picker to my project but am having issues doing so as I am not as VBA savvy as I would like to be, so could you please state or show how i would do this.

    What I would like to do is have a textbox/combobox populated with a date selected from the calendar on a button click.

    I also notice on you sheet1 you have a test file picker, multiple file picker and folder picker, but when I don't see the code that would allow me to adapt these to my form which i would love to do as, based on the nature of my project, they would be extremely useful.

  7. #7
    Forum Contributor
    Join Date
    10-03-2015
    Location
    Jamaica
    MS-Off Ver
    2013
    Posts
    120

    Re: Date Picker / Calendar for Combobox

    My bad, from you sample userform i fumbled my way and now know how to adapt to my userform. I do have a question though the date is produced in this format Tue 11/24/2015 (the code that produces this from what I see is Format(sDateString, "ddd mm/dd/yyyy"). is there away to have the date produced in the following format Tuesday, November 24, 2015?

    Also

    regarding the Multiple filepicker, single file picker and folder picker, how can I adapt these to my userforms

  8. #8
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Date Picker / Calendar for Combobox

    In the UserForm module the output from the UserForm is a generic date of the form "Jul 6, 2015". You can use the Format Statement (red) in the code below to format the output as you require. 'dddd' will give you 'Tuesday', and 'ddd' will give you 'Tue'.
    Please Login or Register  to view this content.
    To adapt the other code to UserForms:
    a. I usually use the 'Enter' Event in a UserForm to implement the other 'Picker' code. For example, using 'TextBox1':
    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    10-03-2015
    Location
    Jamaica
    MS-Off Ver
    2013
    Posts
    120

    Re: Date Picker / Calendar for Combobox

    Thanks much for the response re date.

    Re the other picker code, in the example given what would be populated textBox1?

  10. #10
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Date Picker / Calendar for Combobox

    Please Login or Register  to view this content.
    The above code tells Excel to put the data in 'TextBox1'. Since the code is in the UserForm code module it does not have to be preceded by 'UserForm1' (e.g. UserForm1.TextBox1.Value).

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. How to add a date picker / Calendar from clicking a cell
    By RichardJSigKits in forum Excel General
    Replies: 6
    Last Post: 02-09-2013, 12:52 PM
  2. [SOLVED] Calendar Option in the user form - date picker
    By skhari in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-03-2012, 02:46 AM
  3. Replies: 3
    Last Post: 09-06-2010, 02:31 PM
  4. [SOLVED] mscmctl2.ocx ... calendar and date picker sometimes not available
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-11-2005, 08:05 AM
  5. [SOLVED] Creating a calendar in a cell for a date-picker
    By MarkieE in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-25-2005, 09:06 PM

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