|
既にポイントをついた回答を頂いています。
以下、蛇足です。
例です。
Sub Sample2()
Dim k As Long
Dim ws As Worksheet
Dim rng As Range
'左から1番目から3番目のシートを繰り返す
For k = 1 To 3
Set ws = Worksheets(k)
For Each rng In ws.Range("B2:E20").Rows
If WorksheetFunction.CountA(rng) = 0 Then rng.EntireRow.Hidden = True
Next rng
Next
End Sub
Sub Sample3()
Dim s As Variant
Dim ws As Worksheet
Dim rng As Range
Dim k As Long
'シート名を列挙する方式
For Each s In Array("Sheet1", "Sheet2")
Set ws = Worksheets(s)
For Each rng In ws.Range("B2:E20").Rows
If WorksheetFunction.CountA(rng) = 0 Then rng.EntireRow.Hidden = True
Next rng
Next
End Sub
|
|