請測試看看,謝謝
Sub test()
Dim Arr, i%, j%, n%
Application.ScreenUpdating = False
Arr = Range("b1:m43")
For i = 3 To UBound(Arr)
n = 0
If Arr(i, 1) = "" Then
For j = 1 To UBound(Arr, 2)
If Arr(i, j) = "" Then n = n + 1
Next
If n = 12 Then Rows(i).EntireRow.Hidden = True
End If
Next
Application.ScreenUpdating = True
End Sub作者: PJChen 時間: 2021-10-2 07:44
Sub 隱藏空白行()
Dim R&, xR As Range, xE As Range, i&, j&, k%
Range("G:G").EntireRow.Hidden = False
R = [g65536].End(3).Row
For i = R To 1 Step -1
Set xR = Cells(i, "g")
If xR = "合計" Then k = 1: Set xE = xR(0)
If k = 0 Then GoTo i01
If xR(0) <> "" Then
If xR = "合計" Then MsgBox "品名已填滿, 沒有空白行": Exit Sub
If xR(0) = "品名" Then MsgBox "品名全部空白": Exit Sub
Exit For
End If
i01: Next i
Range(xR, xE).EntireRow.Hidden = True
End Sub作者: PJChen 時間: 2021-10-2 21:19