Macro to Hide Rows w/ specified value in specific row.

gabribasa

New Member
Joined
Aug 16, 2011
Messages
23
Hi Mr. Excel,

I'm using Excel 2007 and Windows XP.

1. General Question: How to create a macro to hide rows that have a specific value in a specific column.
(I have tried duplicating/editing some of the macros on here but my lack of microsoft basic knowledge limits my editing capabilities. )

2. Background Info:
a. Currently I have a system in place to update customer "Checklists." Once we "Have" an item, we put an "X" in the have box, and then delete the row for each thing we have.
We then update the customer by converting the excel document to a pdf and we send it to them.

b. I would not only like to change this to just hiding the cells, but I would love it if the excel document could automatically do this.

3. Specific Values:
The spreadsheet I'm working on has a "Have" Column in which we place an "X."

When Colunm C has an "X" in a certain row, I want that row to be hidden. (But I still want to be able to reveal it if I want.)

So have a "Ctrl - h" command for hide, and a "Ctrl - r" command for reveal. That way all we have to do to send an updated checklist is press "Ctrl - h" convert to pdf, and then either remove the macro or press "Ctrl -r" to reveal the rows that were previously hidden.
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Try this

Code:
Sub HideRows()
Dim LR As Long, i As Long
Application.ScreenUpdating = False
LR = Cells.Find(What:="*", SearchDirection:=xlPrevious, SearchOrder:=xlByRows).Row
For i = 1 To LR
    Rows(i).Hidden = Range("C" & i).Value = "X"
Next i
Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,505
Messages
6,179,151
Members
452,891
Latest member
JUSTOUTOFMYREACH

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