+ Reply to Thread
Results 1 to 3 of 3

Combo Boxes

  1. #1
    Registered User
    Join Date
    06-29-2006
    Posts
    28

    Combo Boxes

    Hello,

    I was wondering if there was a way to set the default value of the combo box? Like I've populated my combo box with employee names taken from the worksheets, and it works all fine and stuff. But instead of the combo box showing a blank space on initialize, I would like it to take the name of one of the employees by default.

    Is that possible?

    Also, regarding the calender control, is it possible to have the calender always take the current date of the computer as the setted default date?

    One last thing, I have this UserForm_Initialize() Sub which populates my combo box on initialization. Works perfectly. Now if there are no employees in the system, I want it to display a message and then the userform should close automatically since there are no employees. I tried using the Unload Me code, but I got the

    Run-time error '91':

    Object variable or With block variable not set
    I am assuming it has to the with the fact that I can't have an Unload Me code inside an initialization sub. Is there a way to work around this?
    Last edited by FCC; 07-02-2006 at 10:15 PM.

  2. #2
    Norman Jones
    Guest

    Re: Combo Boxes

    Hi FCC,

    Try:

    '=============>>
    Private Sub UserForm_Activate()
    Me.ComboBox1.Value = "Elvis"
    Me.Calendar1.Value = Date
    End Sub
    '<<=============


    --
    ---
    Regards,
    Norman



    "FCC" <FCC.2acik0_1151890202.4321@excelforum-nospam.com> wrote in message
    news:FCC.2acik0_1151890202.4321@excelforum-nospam.com...
    >
    > Hello,
    >
    > I was wondering if there was a way to set the default value of the
    > combo box? Like I've populated my combo box with employee names taken
    > from the worksheets, and it works all fine and stuff. But instead of
    > the combo box showing a blank space on initialize, I would like it to
    > take the name of one of the employees by default.
    >
    > Is that possible?
    >
    > Also, regarding the calender control, is it possible to have the
    > calender always take the current date of the computer as the setted
    > default date?
    >
    >
    > --
    > FCC
    > ------------------------------------------------------------------------
    > FCC's Profile:
    > http://www.excelforum.com/member.php...o&userid=35888
    > View this thread: http://www.excelforum.com/showthread...hreadid=557734
    >




  3. #3
    Registered User
    Join Date
    06-29-2006
    Posts
    28
    Cool it worked. Do you know the answer to the Initialize and Unload Me concern that I have?
    Last edited by FCC; 07-02-2006 at 10:53 PM.

+ 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