Another Hide/Show Excel rows question

I have reviewed questions answered concerning hiding and showing rows in Excel; however, I  have not quite found something that I could modify to obtain the results I need.

If the experts here would take  a look at my attached spreadsheet, it gives a very detailed example of what I am needing.   Any and all help is greatly appreciated.

Rick NorrisAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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.

Martin LissOlder than dirtCommented:
I assume the rows to be hidden are on the Decision Matrix sheet. Given that the listbox says Company 1 is that the only company that is affected?

Is a VBA solution acceptable?
Martin LissOlder than dirtCommented:
In any case try this macro.

Sub ShowHide()
Dim strListBoxValue As String
Dim rngFound As Range
Dim lngRow As Long

strListBoxValue = "Company 1"
Set rngFound = Columns("A:A").Find(What:=strListBoxValue, LookAt:=xlWhole, MatchCase:=False, SearchFormat:=False)

For lngRow = rngFound.Row + 1 To ActiveSheet.UsedRange.Rows.Count + 1
    If Cells(lngRow, "B") = "" Then
        Exit For
    End If
    If UCase(Cells(lngRow, "D")) = "X" Then
        Cells(lngRow, "A").EntireRow.Hidden = True
        Cells(lngRow, "A").EntireRow.Hidden = False
    End If

End Sub

Open in new window

Rick NorrisAuthor Commented:

Rows to be dynamically hidden/shown are on the "Example" sheet.

Please review that sheet....  

Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Martin LissOlder than dirtCommented:
Please review that sheet....
I did and my code hides Criteria 2 for Company 1. What should it do differently?
Rick NorrisAuthor Commented:
If you could attach the spreadsheet you are working with would be appreciated.....  When I paste in code I get an error....

When Company changes on the "EXAMPLE" sheet, then DECISION MATRIX tab is evaluated to determine what rows to hide or show on the EXAMPLE sheet.

Martin LissOlder than dirtCommented:
OK here it is. Note that I couldn't find a listbox anywhere so I hard-coded the "Company 1" value into the macro. If you'd supply a wb with that listbox I could modify the code for you if you need me to.

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
Rick NorrisAuthor Commented:

Thanks for the workbook....  Works for what I need....  Now I just need to expand on your work for my real world problem.

Thanks again!!
Martin LissOlder than dirtCommented:
Let me know (here if you like) if you need help. In any case you're welcome and I'm glad I was able to help.

In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2015
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 Office

From novice to tech pro — start learning today.