found this Macro and works well for deleting rows that are completely blank.
The user's issue is that the rows all have formulas in them - the user wants to delete them if there is no value.
How would the user modify this code to accommodate that?
Code:
Sub RemoveLinebreaks()
Dim Rw As Range
If WorksheetFunction.CountA(Selection) = 0 Then
MsgBox "No data found", vbOKOnly, "OzGrid.com"
Exit Sub
End If
With Application
.Calculation = xlCalculationManual
.ScreenUpdating = False
Selection.SpecialCells(xlCellTypeBlanks).Select
For Each Rw In Selection.Rows
If WorksheetFunction.CountA(Selection.EntireRow) = 0 Then
Selection.EntireRow.Delete
End If
Next Rw
.Calculation = xlCalculationAutomatic
.ScreenUpdating = True
End With
End Sub
I assume you want the empty cells from A11:J45 deleted. See attached.
Code:
Sub Maybe()
Dim lr As Long
Dim i As Long
Application.ScreenUpdating = False
lr = Cells(Rows.Count, 1).End(xlUp).Row
For i = lr To 12 Step -1
If Range("A" & i).Offset(, 1).HasFormula = True And Range("A" & i).Offset(, 1).Value = 0 Or _
Range("A" & i).Offset(, 1).HasFormula = True And Range("A" & i).Offset(, 1).Value = "" Or _
Range("A" & i).Offset(, 1).Value = "" Then Range("A" & i).Resize(, 10).Delete Shift:=xlUp
Next i
Application.ScreenUpdating = True
End Sub
Click here to visit our Free 24/7 Excel/VBA Help Forum where there are thousands of posts you can get information from, or you can join the Forum and post your own questions.