Skip to content

Instantly share code, notes, and snippets.

@josephmosby
Created December 23, 2010 19:51
Show Gist options
  • Save josephmosby/753455 to your computer and use it in GitHub Desktop.
Save josephmosby/753455 to your computer and use it in GitHub Desktop.
Simple script to hide spreadsheet rows based on criteria.
Sub HideRows()
Dim testRow As Integer
Dim testSht As Worksheet
Set testSht = Worksheets("Sheet1")
testRow = 2
While Cells(testRow, 1).Value <> "Total"
If Cells(testRow, 2).Value = "" And Cells(testRow, 4).Value = "" And Cells(testRow, 6).Value = "" Then
If Cells(testRow, 1).Value <> "" Then
Rows(testRow).EntireRow.Hidden = True
End If
End If
testRow = testRow + 1
Wend
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment