+ Reply to Thread
Results 1 to 8 of 8

Changing Combobox for valid dates from a list

  1. #1
    Registered User
    Join Date
    08-16-2012
    Location
    Israel
    MS-Off Ver
    Excel 2010
    Posts
    20

    Changing Combobox for valid dates from a list

    Hi there,

    I would like to give a user the option to pick a date from a list (without seeing it).
    I would like to do it with 3 combobox so that user can pick separately year, month and day but only for what valid (in the list).

    for example, for the dates 1/1/2006-15/2/2006:
    1. user picks combobox for year: 2006
    2. user picks combobox for month: 1 or 2
    3. user picks combobox for day: 1-31 (for month 1) or 1-15 (for month 2, which means he can't even see 16-31 in that combox)

    To be clear - there can be a case when 8/1/2006 is not on the list so when you pick 2006 and then 1 you don't see the 8 option in the combobox.

    how can I do that?
    is it necessary to use VBA or can I do it more simple?

    Thank you!

  2. #2
    Forum Contributor
    Join Date
    07-27-2012
    Location
    California, USA
    MS-Off Ver
    Excel 2003
    Posts
    198

    Re: Changing Combobox for valid dates from a list

    The attached workbook was done with Excel 2003. It has
    a form that includes 3 combo boxes to select year, month and day.
    Try it out and see if it can help you with your solution.
    It works off a list of dates listed in chronological order in Sheet2,
    excluding weekends.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    08-16-2012
    Location
    Israel
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Changing Combobox for valid dates from a list

    That looks great but I would like to do that without a Userform, is that possible?

    I tried to take part of your code and I get error 424 on the line
    ComboBox1.List = yearDict.Keys
    altough I did create the ComboBox1.
    I removed the Me. cause it's not a userform but I don't think this is the problem....

    any ideas?


    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    07-27-2012
    Location
    California, USA
    MS-Off Ver
    Excel 2003
    Posts
    198

    Re: Changing Combobox for valid dates from a list

    Sorry, I can't advise you on this. I am not familiar
    with using combo boxes on a worksheet, and since you have
    a newer version of Excel, maybe someone on the forum can
    advise you whether you can do what my form does, but on
    the worksheet with Excel 2010.

  5. #5
    Registered User
    Join Date
    08-16-2012
    Location
    Israel
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Changing Combobox for valid dates from a list

    Still can't figure it out, something here is really wrong because I can't get to make even a simple combobox with changing range.
    I tried even simple codes just to see how it works and all failed!

    some of them contains this:
    Me.ComboBox1.List
    or
    Me.ComboBox1.ListFillRange
    and I get the error "Invalid use of Me Keyword"

    some of them are basic:
    ComboBox1.List
    or
    ComboBox1.ListFillRange
    and I get the error "Object required" (although I did create the combobox)

    Please pay attention that I'm trying to populate a combobox from sheet and not from a userform.

    Anyone PLEASE??

  6. #6
    Forum Contributor
    Join Date
    07-27-2012
    Location
    California, USA
    MS-Off Ver
    Excel 2003
    Posts
    198

    Re: Changing Combobox for valid dates from a list

    I believe that you will get help with the "Object Required" error
    if you attach a file that gives you this error.

  7. #7
    Registered User
    Join Date
    08-16-2012
    Location
    Israel
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Changing Combobox for valid dates from a list

    can't attach any file, it's a secure network at my place of work.

    I'll be very grateful if someone can help without any attachment....

  8. #8
    Forum Contributor
    Join Date
    07-27-2012
    Location
    California, USA
    MS-Off Ver
    Excel 2003
    Posts
    198

    Re: Changing Combobox for valid dates from a list

    Try this. In a new sheet, add a combo box from the ActiveX controls.
    Click on the combo in design mode and display the properties list to view
    what the name of the combo is; it should be ComboBox1.

    Leave design mode whenever you want to test populating the combo.

    Copy and paste code you have used in your other trials to
    populate the combo box, and this code should be run in the module
    of the same worksheet that has the combo.

    If you get an error and can't work through it, post your VBA code
    in hash tags, and maybe that will give someone a clue about the
    problem.

+ 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. [SOLVED] New to Forms-Validate a ComboBox and do something if not valid
    By mc84excel in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-18-2013, 08:05 PM
  2. [SOLVED] Having trouble changing a combobox fill list with a macros
    By pheonix0 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-17-2012, 02:05 PM
  3. Find a list of dates in a changing calendar!
    By craigafrica in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-23-2008, 10:31 AM
  4. Changing background color of a combobox list entry
    By Schwizer in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-22-2007, 11:01 AM
  5. Checking for valid dates on entry
    By Ian in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-25-2005, 01:05 PM

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