• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Excel Table column as Combobox list in userform

Babaand

New Member
Dear sir
I have excel Table for Data and I want to set excel Table column as combo box input list so that I can select information from combo box on userform

Pls Guide and Thanks in advance
______________________________________________________________
Mod edit : thread moved to appropriate forum !
 
Thank u sir for response,
I'm now sending the sample file and my needs My need is written in place of code of combobox in the file pls help
 

Attachments

  • SAMPLE.xls
    36 KB · Views: 13
The simplest way is to select the control and then set the Row Source
upload_2016-7-11_9-16-9.png

You can do the same for the Division, except you will have to use Range: Sheet1!$E$6:$E$9
Not Sheet1!$F$5:$I$5 as you would expect
 
Pls sir,
Let understand that
1) I have two combo boxes that combo box1 for selecting standard and combo box2 for selecting division

2) I have to set row source of combo box1 from table column STD and combo box2 from table column DIV i.e. 5, 6, 7, 8, 9, 10 which is on sheet1

3) That means If I select standard 5 from combo box1 then the Row source of combo box2 should be table column 5 so that I can select Divisions of Standard 5.

4) If I selected standard 7 in combo box1 then the Row source of combo box2 should be column 7 from Table

5) Also Note that, the Row source of combo box should be the Name of table column i.e. STD, 5, 6,7....... but not Sheet1!$E$5:$E$11 ......

Pls guide
 

Attachments

  • SAMPLE.xls
    39.5 KB · Views: 13
1) Clear RowSource property in ComboBox1, otherwise you will get Error.
2) Replace the codes with the following
Code:
Private Sub UserForm_Initialize()
    With Sheets("sheet1")
        Me.ComboBox1.List = .Range("TblStd3[STD]").Value
    End With
End Sub
Private Sub ComboBox1_Click()
    Me.ComboBox2.Clear
    If Me.ComboBox1.ListIndex = -1 Then Exit Sub
    With Sheets("sheet1")
        On Error Resume Next
        Me.ComboBox2.List = .Range("TblStd3[" & Me.ComboBox1.Value & "]").Value
        On Error GoTo 0
    End With
End Sub
 
1) Clear RowSource property in ComboBox1, otherwise you will get Error.
2) Replace the codes with the following
Code:
Private Sub UserForm_Initialize()
    With Sheets("sheet1")
        Me.ComboBox1.List = .Range("TblStd3[STD]").Value
    End With
End Sub
Private Sub ComboBox1_Click()
    Me.ComboBox2.Clear
    If Me.ComboBox1.ListIndex = -1 Then Exit Sub
    With Sheets("sheet1")
        On Error Resume Next
        Me.ComboBox2.List = .Range("TblStd3[" & Me.ComboBox1.Value & "]").Value
        On Error GoTo 0
    End With
End Sub





Sorry sir,
I have tried this code but I have no success this code is repling as error message that is uploaded with this file
 

Attachments

  • error message.docx
    191.2 KB · Views: 8
Back
Top