Skip to content

Instantly share code, notes, and snippets.

@dawncold
Created November 13, 2016 10:42
Show Gist options
  • Save dawncold/1047d659e00e9668bde5dcafd994a18b to your computer and use it in GitHub Desktop.
Save dawncold/1047d659e00e9668bde5dcafd994a18b to your computer and use it in GitHub Desktop.
hide some rows in excel
Sub LoopThroughSheets()
Dim ws As Worksheet
Dim endDate As Date
endDate = DateValue("2016/10/09")
For Each ws In ActiveWorkbook.Worksheets
If ws.Name <> "汇总" Then
For Each rw In ws.Rows
If rw.Cells(1).Value = "" Then
Exit For
End If
If rw.Cells(1) <> "日期" And Not rw.EntireRow.Hidden Then
If CDate(rw.Cells(1).Value) < endDate Then
rw.EntireRow.Hidden = True
End If
End If
Next rw
End If
Next ws
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment