I found this thread and I need something for a sheet I'm working on that is very similar. What I need to do though is hide an entire row if one cell in that row contains a certain word.
How would I modify the above code to do this?
I found this thread and I need something for a sheet I'm working on that is very similar. What I need to do though is hide an entire row if one cell in that row contains a certain word.
How would I modify the above code to do this?
Assuming your one cell is A1 then you could use this.
![]()
If Range("A1") = "your word" Then Range("A1").EntireRow.Hidden = True Else Range("A1").EntireRow.Hidden = False End If
Hi,Originally Posted by evilrtc
Trywill work for the A cell of the row, but I'm not sure how that fits into a thread for columns.![]()
Sub Macro1() ' Hide Rows Dim iRow As Long Dim iLastRow As Integer With ActiveSheet iLastRow = ActiveSheet.Range("A65536").End(xlUp).Row For iRow = iLastRow To 1 Step -1 If .Cells(iRow, 1) = "a certain word" Then .Rows(iRow).EntireRow.Hidden = True End If Next End With End Sub
Do you need the code to test any other cells? - is the 'word' the only content of the cell? - you need to confirm what is required.
hth
---
Si fractum non sit, noli id reficere.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks