|
发表于 2014-3-18 23:21:42
|
显示全部楼层
Somewhat condensed notation:
Code: Private Sub Worksheet_Calculate()
Dim LstRw As Long, Rw As Long
Application.ScreenUpdating = False
'''Un-hide all rows to start with
Rows("15:" & LstRw).Hidden = False
'''Define LstRw as the last row in column F with data.
LstRw = Cells(Rows.Count, "G").End(xlUp).Row
''' Go through column G (starting at row 15) & hide all rows with a value of 0
For Rw = 15 To LstRw
If Cells(Rw, "G") = "" Then Rows(Rw).Hidden = True
Next
Application.ScreenUpdating = True
End Sub
I also do not see why this would not work.
Although in general I dislike the Worksheet_Calculate() event. I would rather go for a Worksheet_Activate() event.
By the way, instead of looping, consider an autofilter / advanced filter. And have a look at SpecialCells too. |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
|