+ Reply to Thread
Results 1 to 2 of 2

ComboBox1

  1. #1
    Forum Contributor
    Join Date
    02-24-2005
    Posts
    154

    ComboBox1

    I have generated a ComboBox1 in a UserForm1.
    I have a list of data in Sheets("DoNotUse").Range("L3", "L57").
    How do I get that list into my ComboBox.

    If it helps, this list is called 'grade' using 'Insert', 'Name', 'Define'.
    Is a ComboBox the best thing to use or should I be using a ListBox?

    I'm using Office97 so I think it is something to do with the RowSource in Properties.
    I have put L3:L57 in the RowSource but how do I tell it that its L3:L57 on Sheets("DoNotUse") which is different from the sheet that I will be calling the UserForm from??
    Last edited by grahammal; 03-20-2006 at 06:49 AM.

  2. #2
    Dave Peterson
    Guest

    Re: ComboBox1

    One way is to use:

    Option Explicit
    Private Sub UserForm_Initialize()
    With Me.ComboBox1
    .List = ThisWorkbook.Worksheets("donotuse").Range("define").Value
    End With
    End Sub

    If the cells contained values that were nicely formatted, you could add those
    nicely formatted values to the combobox:

    Option Explicit
    Private Sub UserForm_Initialize()
    Dim myCell As Range
    Dim myRng As Range

    Set myRng = ThisWorkbook.Worksheets("donotuse").Range("define")

    With Me.ComboBox1
    For Each myCell In myRng.Cells
    .AddItem myCell.Text
    Next myCell
    End With
    End Sub




    grahammal wrote:
    >
    > I have generated a ComboBox1 in a UserForm1.
    > I have a list of data in Sheets("DoNotUse").Range("L3", "L57").
    > How do I get that list into my ComboBox.
    >
    > If it helps, this list is called 'grade' using 'Insert', 'Name',
    > 'Define'.
    > Is a ComboBox the best thing to use or should I be using a ListBox?
    >
    > --
    > grahammal
    > ------------------------------------------------------------------------
    > grahammal's Profile: http://www.excelforum.com/member.php...o&userid=20336
    > View this thread: http://www.excelforum.com/showthread...hreadid=524268


    --

    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