ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Hiding rows based on a cell? (https://www.excelbanter.com/excel-worksheet-functions/213284-hiding-rows-based-cell.html)

OX_Gambit

Hiding rows based on a cell?
 
Is there a way that I can hide a row based on a cells value? Or do I have to
run a macro to do so?

I will be positng this in the Programming section as well.

Bernard Liengme

Hiding rows based on a cell?
 
To truly hide, you would need a macro
However, you could make it look blank using conditional formatting making
the font colour match the worksheet background colour (generally white)
best wishes

--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"OX_Gambit" wrote in message
...
Is there a way that I can hide a row based on a cells value? Or do I have
to
run a macro to do so?

I will be positng this in the Programming section as well.




Gary''s Student

Hiding rows based on a cell?
 
Say we want to hide all rows in which column A contains "XXX":

Sub hideum()
Dim i As Long
n = Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To n
If Cells(i, 1).Value = "XXX" Then
Rows(i).Hidden = True
End If
Next
End Sub

--
Gary''s Student - gsnu200819

Tami

Hiding rows based on a cell?
 
sorry for tagging on to this old post but its very similar to a question i
have. but for starters, i simply copy/pasted the below macro on the "view
code".
i typed in various values down column A, including a couple of examples of
xxx.


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

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