+ Reply to Thread
Results 1 to 7 of 7

Pre-Setting ComboBox Value

  1. #1
    Registered User
    Join Date
    06-25-2010
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2003
    Posts
    34

    Pre-Setting ComboBox Value

    I have a UserForm which asks for a date with three separate ComboBox (month, day, year).

    I have initialized them as follows:

    Please Login or Register  to view this content.
    What I am trying to do is pre-set them with the current date. I have attempted it with the commented out code at the bottom which gives an error "Type Mismatch"

    Any ideas on how I can successfully pre-set them?

    Thanks!

    Also posted at: http://www.mrexcel.com/forum/showthr...15#post2382015
    Last edited by nbuk; 07-20-2010 at 11:22 AM.

  2. #2
    Registered User
    Join Date
    06-25-2010
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2003
    Posts
    34

    Re: Pre-Setting ComboBox Value

    I have also tried using ListIndex but I still get the same error.

    Please Login or Register  to view this content.

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

    Re: Pre-Setting ComboBox Value

    Why not using a combobox with all the dates of this year ?

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    06-25-2010
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2003
    Posts
    34

    Re: Pre-Setting ComboBox Value

    Putting all the dates of the year into one combobox would make it very large, no?

    I am not familiar with how this code works. Could you please explain exactly what it does?

    Thanks

    Edit:

    I tried the code and it works fine with displaying the dates, but today's date is not pre-selected, which is what I need. Is there any way to add on to that?
    Last edited by nbuk; 07-20-2010 at 11:32 AM.

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

    Re: Pre-Setting ComboBox Value

    There's an example of using Comboboxes for dates here

    http://excel-it.com/free_addins.htm
    Hope that helps.

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

    Free DataBaseForm example

  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: Pre-Setting ComboBox Value

    snb,you've already been asked when posting complex code,in my opinion overly complex, to add explanations.

    You never seem to bother following up on any requests from members

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

    Re: Pre-Setting ComboBox Value

    Please Login or Register  to view this content.

+ 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