0 Then k = k + 1 End If Next j If k > 0 Then Rows(i).Select Selection.EntireRow.Hidden = True End If Next i End Sub .">
Most valuable professional
  • Hot Topics

Excel Hide Rows that <> "string"

Hi, I found below formula in this forum that works really great on hiding all rows if it matches the string in any column of the row. However, I would like it to be reversed. Meaning, it will hide all rows that is NOT match to the string and also NOT blank (to avoid hiding rows of the entire worksheet). Also it needs to apply from row 5 then below. What I want to achieve is that I want to create a validation list consists of Dept name above row 5 and a table below it will only show the row records for the particular dept only. This is to avoid other users from other dept to meddle with records for other depts. Anyone can help,please? Thank you in advance. Sub hiderows() For i = 1 To Range("A" & Rows.Count).End(xlUp).Row k = 0 For j = 1 To Range("A" & i).End(xlToRight).Column If InStr(1, Cells(i, j), "Circuit Total") > 0 Then k = k + 1 End If Next j If k > 0 Then Rows(i).Select Selection.EntireRow.Hidden = True End If Next i End Sub

This question generated 26 answers. To proceed to the answers, click here.

This thread is current as of February 27, 2014.

For more resources for Microsoft Excel:

This article includes the following tags:

  • Excel
  • Microsoft Excel