macro to hide rows if column

smiler44

Registered User.
Local time
Today, 22:46
Joined
Jul 15, 2008
Messages
671
I am in need of a macro to hide rows where column C does not contain
and of these values, there will only be 1 value per cell.
book, car, plane, boat, pencil, rubber, rule, pen.

lots of macros to hide rows that do contain criteria but could not find one or get one to work where I had 7 items to leave visible and hide the rest

thank you smiler44
 
The article (and I) assume(s) you are familiar with queries. If this is not the case then there are some basics you need to learn before you start dabbling with macros and VBA.

ARE you familiar with queries?
 
I think I've just had a lightbilb moment.
this is a modified macro I found on the internet

Code:
BeginRow = 2
    EndRow = 20
    ChkCol = 3
    For RowCnt = BeginRow To EndRow
        If Cells(RowCnt, ChkCol).Value <> "Brand House" And Cells(RowCnt, ChkCol).Value <> "Local Brand Family Group" Then 
            Cells(RowCnt, ChkCol).EntireRow.Hidden = True
        Else
            Cells(RowCnt, ChkCol).EntireRow.Hidden = False
        End If
    Next RowCnt

this seems to work for 2 criteria's i'll try with 7

smiler44
 
My apologies...I assumed you were using Access. Sorry mate, I can’t help you.
 
The article (and I) assume(s) you are familiar with queries. If this is not the case then there are some basics you need to learn before you start dabbling with macros and VBA.

ARE you familiar with queries?

not sure i understand the question :)
count myself as an amateur that has hook or by crook created some very successful bits of automation.
Google is my friend but even then I do find I need personal help
and this is where I turn to a form

smiler44
 
I'd start by recording a macro. That would probably do all you need if you already have one of each value. If not, just edit the macro, the change should be obvious.

I am in need of a macro to hide rows where column C does not contain
and of these values, there will only be 1 value per cell.
book, car, plane, boat, pencil, rubber, rule, pen.

lots of macros to hide rows that do contain criteria but could not find one or get one to work where I had 7 items to leave visible and hide the rest

thank you smiler44
 

Users who are viewing this thread

Back
Top Bottom