I'm having the following issue. I have a matrix, in which I would like to hide rows, based on the values in cells in those rows. I've made a small example in Excel, which I uploaded here.
The rows containing a Y I would like to keep, where I would like to hide the rows not containing a Y.
I only got it to work using this formula:
Formula:
Private Sub Hide_Rows()
Range("C2:K7").EntireRow.Hidden = True
Dim c As Range
For Each c In Range("C2:K7").Cells
If c.Value = "Y" Then
c.EntireRow.Hidden = False
End If
Next c
End Sub
The problem with this formula is, that after executing it, it ends with an error at this line:
" If c.Value = "Y" Then"
Note: This is a test file, for some reason it does not give the error in this file. The other file I cannot upload due to being a company file.
Anyone has a clue, or maybe a better way to hide the rows without the Y value?
Bookmarks