Deselect certain items in Drop Down list

mocephur

New Member
Joined
Jul 11, 2007
Messages
14
Hi Gurus,

I need some help with an excel workbook I have. I have a worksheet that is auto filtered for all columns, in column I is a list of business names, 2000 or more and growing. I would like to write a macro that "deselects" certain business names in column I from showing. What is a good way of doing this?

example:

Column I

Business Org Name
ABC Plumbing
Total Electric
Wrong Way
Right way
etc.

I'd like a macro that "deselects" Total Electric & Wrong Way from showing on the sheet. In actuality, I would be deselecting 27 business names for my needs.

Thanks!
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Change red data for your information

In column AY list the business names from row 1 and down.
Change T by the last column with data

Code:
Sub Macro()
    Dim aItems(), b As Range, c As Range, i As Long
    
    i = -1
    If ActiveSheet.AutoFilterMode Then ActiveSheet.AutoFilterMode = False
    For Each c In Range("I2", Range("I" & Rows.Count).End(xlUp))
        Set b = Range("[B][COLOR=#ff0000]AY:AY[/COLOR][/B]").Find(c.Value, LookIn:=xlValues, lookat:=xlWhole)
        If b Is Nothing Then
            i = i + 1
            ReDim Preserve aItems(i)
            aItems(i) = c.Value
        End If
    Next
    ActiveSheet.Range("A1:[B][COLOR=#ff0000]T[/COLOR][/B]" & Range("I" & Rows.Count).End(xlUp).Row).AutoFilter Field:=9, Criteria1:=Array(aItems), Operator:=xlFilterValues
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,817
Messages
6,181,147
Members
453,021
Latest member
Justyna P

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