Hi, BigBas
I have a couple suggestions...
First, if it isn't already, the DeleteBlankRows code should be in a General Module in your Personal.xls. That way, it will be available to ALL workbooks.
Second, I'd use slightly more durable and efficient code. There's no need to start at the absolute bottom of the sheet if the used range only extends to Row_45, right?
Sub DeleteBlankRows()
Dim lngEndRow As Long
Dim lngCtr As Long
Dim CurrCalcSetting
' Check if the sheet is protected
If ActiveSheet.ProtectContents Then
MsgBox ActiveSheet.Name & " is protected"
Exit Sub
End If
With Application
' Store the current calculation setting (to restore it later)
CurrCalcSetting = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With
On Error GoTo errTrap
With ActiveSheet
lngEndRow = .UsedRange.Rows.Count
For lngCtr = lngEndRow To 3 Step -1
If .Cells(lngCtr, 3) = "" Then
.Cells(lngCtr, 3).EntireRow.Delete
End If
Next lngCtr
End With
errTrap:
' Reset efficiency settings
With Application
.Calculation = CurrCalcSetting
.ScreenUpdating = True
End With
If Err.Number <> 0 Then
MsgBox "Problem was encountered"
End If
End Sub
Does that help?
Bookmarks