VBA Combobox Dynamic range with criteria

mrhonda

Board Regular
Joined
Feb 16, 2011
Messages
50
Hello Gents,

I need your expertice again ;)

I have a column (Column B) with ordernumbers like this:
W-1604
C-1605
F-1606
W-1607
F-1608
etc
etc
etc

The numbers are Unique, the letters W, C and F indicate something else.

Can you guys tell me the Code that is needed To list only the 'W' numbers in a combobox on a userform.
The list is Dynamic.

From there on I know what to do :biggrin:

Thanks in advance!
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Overly simplified, but does this help?

Rich (BB code):
Private Sub UserForm_Initialize()
Dim Cell As Range
    
    'Please note, default codename used, change to suit
    With Sheet1
        For Each Cell In Range(.Cells(2, 2), .Cells(.Rows.Count, 2).End(xlUp))
            If UCase(Left(Trim(Cell.Value), 1)) = "W" Then
                Me.ComboBox1.AddItem Trim(Cell.Value)
            End If
        Next
    End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,613
Messages
6,179,904
Members
452,948
Latest member
Dupuhini

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