Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am new to VBA. I have a userform and I have a userbox and have linked it to a table, but I only want to display the first column of the table in my combobox. One issue I have is I have another userform that allows me to enter values into the Table (increasing the table size) so the table is not a set length so cannot call a specific cell range.

What I have tried:

My code for the combobox is

Private Sub UserForm_Initialize()

Dim cust As Range

For Each cust In Sheet1.Range("Table2")
With Me.cboCustomer
.AddItem cust.Value
End With
Next cust

End Sub

I have tried to something like column after range but all I get is an error. This gives me every value in the table.

Probably a simple fix but I just can't get it.

Thanks
Posted
Comments
CHill60 3-Aug-18 14:25pm    
What is the error?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900