Macro for conditionally hidden rows

adamo89

New Member
Joined
Nov 16, 2009
Messages
2
Hi, I'd like to create a Macro in Excel 2007 that will hide each row that has a certain entry in a certain column, and keep all other rows visible, whether the rows started out hidden or not. Can you help? Thanks!
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Welcome to the board!

Which column would you like to evaluate, and what values should cause rows to be hidden?
 
Upvote 0
Hi, give this a try:

Code:
Option Explicit
Sub HideDone()
Dim rngCel As Range
Application.ScreenUpdating = False
Cells.EntireRow.Hidden = False
For Each rngCel In Range(Cells(1, "F"), Cells(Rows.Count, "F").End(xlUp))
    If rngCel.Value = "Done" Then rngCel.EntireRow.Hidden = True
Next
Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,100
Messages
6,128,825
Members
449,470
Latest member
Subhash Chand

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