Option Explicit
Public Sub DeleteBlankEntireRowDemo()
Dim RowID As Integer
Dim sMessage As String
‘ * 错误源
Dim sSource As String
On Error GoTo Err_Handler
For RowID = Range(Cells(1, 1), ActiveSheet.UsedRange).Rows.Count To 1 Step -1
If Application.WorksheetFunction.CountBlank(Rows(RowID).EntireRow) = 256 Then Rows(RowID).Delete
Next
Exit_Label:
On Error GoTo 0
Exit Sub
Err_Handler:
sMessage = “运行出错!” & vbCrLf _
& Err.Description
‘ * 显示友好的错误信息
Call MsgBox( _
Prompt:=sMessage, _
Buttons:=vbExclamation)
GoTo Exit_Label
End Sub