我写了一个代码来删除行本身,如果任何一个单元格在选定范围内是空白的,但是如果没有找到空格则它会被终止。我想进一步运行代码。这是代码: -
Application.ScreenUpdating = False
Columns("A:A").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
Application.ScreenUpdating = True
'For instance if i want the machine to pop up a msgbox,in case if no blanks found
Msgbox "Congrats!"
答案 0 :(得分:1)
测试具有值的单元格数是否与范围中的单元格数相同:
Application.ScreenUpdating = False
With ActiveSheet 'Better practice to assign actual sheet.
If Not Application.WorksheetFunction.CountA(.Range("A:A")) = .Range("A:A").Cells.Count Then
.Columns("A:A").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
Else
MsgBox "Congrats!"
End If
End With
Application.ScreenUpdating = True