I'm new to vba, and appreciate any help.
I'm trying to clean up several long worksheets by removing rows that don't contain a visable number or letter. I want to remove all rows that only contain either empty cells, formulas that evaluate to a empty text string (""), cells that contain error values, or cells that contain zeros, or any combination of the previous. I've stumbled onto the following, but it does not work.
Am I on the right track? Can anyone help modify this or offer a better solution? Thanks in advance.
Sub DeleteBlankRows()
Dim LR As Long, i As Long, j As Long
Dim LC As Integer, ConditionCounter As Integer
Application.ScreenUpdating = False
LR = ActiveSheet.UsedRange.Rows.Count
LC = ActiveSheet.UsedRange.Columns.Count
For i = 1 To 1 Step -1
For j = LC To 1 Step -1
If IsEmpty(Cells(i, j)) = True Then
ConditionCounter = ConditionCounter + 1
Else
If WorksheetFunction.IsText(Cells(i, j)) = True And (Cells(i, j)) = """" Then
ConditionCounter = ConditionCounter + 1
Else
If WorksheetFunction.IsText(Cells(i, j)) = False And (Cells(i, j)) = 0 Then
ConditionCounter = ConditionCounter + 1
End If
End If
End If
Next j
If ConditionCounter = LC Then
Rows(i).EntireRow.Delete
Else
End If
Next i
Application.ScreenUpdating = True
End Sub
Bookmarks