Hiding and unhiding rows

iazcac

New Member
Joined
Sep 26, 2007
Messages
26
I have what I think is a simple problem but have hit a brick wall!!

I have two columns :

Column A - Date Completed
Column B - Status

It is set up that when column A is blank, Column B displays "OPEN"

Once Column A has a date in it, then Column B displays "CLOSED"



What I require is that once Column B displays "CLOSED" the row becomes hidden. I have managed to do this with the following code:


Private Sub Worksheet_Change
On Error GoTo enditall
Application.EnableEvents = False
If Target.Cells.Column = 4 And _
Target.Value = "CLOSED" Then
Target.EntireRow.Hidden = True
End If
enditall:
Application.EnableEvents = True
End Sub

However, what I then require is a button to show all records again as sometimes closed records need to be viewed again. I then require a second button to hide all "CLOSED" records again

Any help greatly appreciated

Thanks
C
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
You need a macro anda button to trigger it, along the lines of

Sub Show_all
Activesheet.Cells.EntireRow.Hidden = False
End Sub
 
Upvote 0
Hi,

That is great for first part to show all records. Thanks.

How do I then just hide the "CLOSED" records again?

Thanks
 
Upvote 0
You need another macro:

Code:
Sub ChangeitBack
 
LastRow = ActiveSheet.Cells.SpecialCells(xlLastCell).Row
for rowcount = 2 to LastRow
If Cells(rowcount,4).Value = "CLOSED" Then cells(rowcount,4).EntireRow.Hidden = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,565
Messages
6,179,549
Members
452,927
Latest member
rows and columns

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