Sub a()
Dim rg As Range
Dim n As Integer
Application.ScreenUpdating = False
n = 1
For Each rg In Application.Intersect(ActiveSheet.UsedRange, Columns("I"))
If rg.Value = "N" Then rg.Select
With Selection
.EntireRow.Hidden = True
End With
Next rg
Application.ScreenUpdating = True
End Sub
excel隐藏整列或者整行。
宏代码如下
隐藏b列
sub 隐藏指定工作表的指定列()
sheet1.columns("b:b").entirecolumn.hidden = true
end sub隐藏2行
sub 隐藏指定工作表的指定行()
sheet1.rows("2:2").entirerow.hidden = true
end sub