execl一键隐藏为0的行(列)VBA
隐藏为0的列
Sub 表二RangeHidde()
Application.ScreenUpdating = False '//关闭屏幕刷新
For Each rg In Range(" H37:CC37")//选取检测范围
If rg.Value = "0" Then
rg.EntireColumn.Hidden = True//【EntireColumn】隐藏列、EntireRow隐藏行
End If
Next
Application.ScreenUpdating = True '//打开屏幕刷新
End Sub
恢复显示
Sub 表二unhidde()
Application.ScreenUpdating = False '//关闭屏幕刷新
For Each rg In Range(" H37:CC37")
rg.EntireColumn.Hidden = False
Next
Application.ScreenUpdating = True '//打开屏幕刷新
End Sub