Help changing this to a Table

wildwally

Board Regular
Joined
Jun 7, 2007
Messages
205
I have this code that I've used in the past to populate the combo box in a userform based on a previous combo box select.

Code:
    If custnamecb.Value = "" Then
        'refresh and look up the customer name by the customer number provided.
        Do
            If ws.Range("B" & CStr(lngRow)).Value = Me.custnumbtb.Text Then
            Me.custnamecb.AddItem ws.Range("C" & CStr(lngRow)).Value
            ElseIf ws.Range("B" & CStr(lngRow)).Value = "" Then
                Exit Do
            End If
            lngRow = lngRow + 1
        Loop
    Else
        'don't do anything
        Exit Sub
    End If

I need to change the ws.range reference to look at columns of a table. (i.e. table[column2] etc.)

need some assistance on this one.
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

Forum statistics

Threads
1,224,585
Messages
6,179,703
Members
452,938
Latest member
babeneker

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top