ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   macro to hide data (with conditional formatting?) (https://www.excelbanter.com/excel-programming/399579-macro-hide-data-conditional-formatting.html)

Ginna Moore

macro to hide data (with conditional formatting?)
 
I have a large spreadsheet and I want it to automatically HIDE a row if a
certain cell value meets a specific criteria. Does anyone know if this can be
done? I know I can do this manually but would like to automate if possible.

Thanks.

JW[_2_]

macro to hide data (with conditional formatting?)
 
I believe this is what you are after. Right click the sheet tab where
you want this to take place and paste this (modify to suite):
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Text = "Freddy" Then _
Target.EntireRow.Hidden = True
End Sub

This will hide the target's row anytime Freddy is entered into it.
Ginna Moore wrote:
I have a large spreadsheet and I want it to automatically HIDE a row if a
certain cell value meets a specific criteria. Does anyone know if this can be
done? I know I can do this manually but would like to automate if possible.

Thanks.



JW[_2_]

macro to hide data (with conditional formatting?)
 
Or you can use something like this in the Workbook_Open event to hide
all rows in Sheet 1 where the value in column A is Freddy.
Private Sub Workbook_Open()
Dim r As Long
With Sheets("Sheet1")
.Rows.Hidden = False
For r = 2 To .Cells(.Rows.Count, 1).End(xlUp).Row
If .Cells(r, 1).Value = "Freddy" Then _
.Cells(r, 1).EntireRow.Hidden = True
'or .Rows(r).Hidden = True
Next r
End With
End Sub

Ginna Moore wrote:
I have a large spreadsheet and I want it to automatically HIDE a row if a
certain cell value meets a specific criteria. Does anyone know if this can be
done? I know I can do this manually but would like to automate if possible.

Thanks.




All times are GMT +1. The time now is 06:07 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com