+ Reply to Thread
Results 1 to 2 of 2

Combo box in Visual Basics

  1. #1
    tamato43
    Guest

    Combo box in Visual Basics

    Hello Everyone,

    I'm fairly new with Visual Basics.

    I'm creating a form and I'd like to add a combo box (drop down Lisyt), and I
    can't seem to figure out how to validate the list from there.

    Does anyone know how or have a reference to this?

    Thank you in advance.

  2. #2
    Dave Peterson
    Guest

    Re: Combo box in Visual Basics

    Next time you're in the VBE working on your userform, click on the combobox and
    hit F4 (to show its properties).

    Then change the style to fmStyleDropDownList--this allows only the items in the
    combobox's list.

    Then you can use the .rowsource property to point at the range that should be
    used for validation.

    If you like you can do this in code, too:

    Option Explicit
    Private Sub UserForm_Initialize()

    Me.ComboBox1.Style = fmStyleDropDownList

    With Worksheets("sheet1")
    Me.ComboBox1.RowSource = .Range("a2", _
    .Cells(.Rows.Count, "A").End(xlUp)).Address(external:=True)
    End With

    End Sub

    There are other ways that can be used to populate the combobox, too--if you're
    doing something special.

    Debra Dalgleish has a list of books at her site:
    http://www.contextures.com/xlbooks.html

    John Walkenbach's is a nice one to start with. I think that John Green (and
    others) is nice, too (for a second book??). See if you can find them in your
    local bookstore and you can choose what one you like best.

    tamato43 wrote:
    >
    > Hello Everyone,
    >
    > I'm fairly new with Visual Basics.
    >
    > I'm creating a form and I'd like to add a combo box (drop down Lisyt), and I
    > can't seem to figure out how to validate the list from there.
    >
    > Does anyone know how or have a reference to this?
    >
    > Thank you in advance.


    --

    Dave Peterson

+ 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