+ Reply to Thread
Results 1 to 3 of 3

Combo box refer to a sheet

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    08-30-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    141

    Combo box refer to a sheet

    Hi guys

    How should i create a combo box that will refer to a list name in a sheet? I have this code but it doesnt function. maybe there is some mistakes in my codes.

    Private Sub ComboBox1_Change()
    Dim ws As Worksheets
    Set ws = Worksheets("LIST NAME")
    For Row = 8 To 1000 'Each cell in the range
    .AddItem ws.Cells(Row, 2)
    Next Row
    End Sub
    Anyone can help me? or suggest another codes that much better?

    Thank you

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,653

    Re: Combo box refer to a sheet

    This will populate ComboBox1 with values from B8:B1000 on the worksheet called LIST NAME when the UserForm initializes.

    Private Sub UserForm_Initialize()
        ComboBox1.List = Worksheets("LIST NAME").Range("B8:B1000").Value
    End Sub
    Last edited by AlphaFrog; 11-16-2012 at 11:47 PM.

  3. #3
    Forum Contributor
    Join Date
    08-30-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    141

    Re: Combo box refer to a sheet

    Hi AlphaFrog

    Thanks for your code. It is work.

+ 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