VBA Filter a combobox range

Bevee

New Member
Joined
Jul 28, 2016
Messages
16
Hi,

How can you filter a combobox range?
I made a registersystem for my sportsclub , i made it that behind the names of the people appear the bill they have to pay
I have a combobox , and the range of it is a range of cells in a sheet.
now i want that if the bill = 0 the name won't appear in the combobox

Thank you
 
With such minimal details you can try this:

Assuming your names are in column "A" of your sheet
And assuming the amount they owe is in column "B"
And assuming your ComboBox is named ComboBox1
You can put this script in a command button:

Code:
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
Dim i As Long
Dim Lastrow As Long
ComboBox1.Clear
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row
    For i = 1 To Lastrow
        If Cells(i, 2) > 0 Then ComboBox1.AddItem Cells(i, 1).Value
    Next
Application.ScreenUpdating = False
End Sub
 
Upvote 0

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