Find specific rows and hide them using a maco

Hi everyone,

I have a spreadsheet with a large number of rows and columns populated with data. Column B is called "Type" and for each row it has a value of either "Simple" or "Configurable" (without the inverted commas). I need a macro that would hide each of the rows where the value is "Simple" in Column B but keep the other rows with a value of "Configurable" showing.

I wondered if anyone could help me with this VBA code?

Really appreciate any help.
LVL 1
gwh2Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rgonzo1971Commented:
Hi,

pls try

Sub Macro1()
    ActiveSheet.Range(Range("B1"), Range("B" & Cells.Rows.Count).End(xlUp)).AutoFilter Field:=1, Criteria1:= _
        "Configurable"
End Sub

Open in new window


EDIT if you do not want to see a filter then try

Sub Macro2()
    ActiveSheet.Range(Range("B1"), Range("B" & Cells.Rows.Count).End(xlUp)).AutoFilter Field:=1, Criteria1:= _
        "Simple"
    Set myRange = ActiveSheet.Range(Range("B2"), Range("B" & Cells.Rows.Count).End(xlUp)).SpecialCells(xlCellTypeVisible)
    ActiveSheet.AutoFilterMode = False
    myRange.EntireRow.Hidden = True
    
End Sub

Open in new window

Regards
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
gwh2Author Commented:
Thanks so much for this - it's absolutely perfect. It's also great that I can use the filter to choose between either simple or configurative. Could I just ask one other thing: do you know how I can make the macro into a button that appears in the ribbon so that someone can just click it to run it?

Thanks again.
0
Rgonzo1971Commented:
Right Click on the ribbon Customize ribbon

Create a new Group that you can rename, place in the tab of your choice or create a new tab

then in Choose command from Macros

then add the macro into the new group, rename it and change the icon if wished
0
gwh2Author Commented:
Ok great - thanks again. Much appreciated.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.