delete rows in which the result of the formula is " "
I would recommend using a For...Each Loop. The For...Each is more efficient
than a Do...Loop when you are working with objects. This procedure below
will scan down Col. A looking for values = "", if it finds one the entire row
is deleted.
Sub DeleteRows()
Dim LastRow As Long
Dim myRange As Range
Dim cell As Range
' finds last row in Col.A
LastRow = Sheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Row
' range of cells to test values
Set myRange = Sheets("Sheet1").Range(Cells(2, 1), Cells(LastRow, 1))
' loop thru each cell in myRange to find "" values
For Each cell In myRange
If cell.Value = "" Then
cell.EntireRow.Delete
End If
Next cell
End Sub
Hope this helps. If so please click "yes" below.
--
Cheers,
Ryan
"marcia2026" wrote:
This is my formula in each row in my table has an if/then statement to pick
up corresponding values from the same rows in other worksheets if the value
in the subsequent worksheet is greater than 0, otherwise leave blank. Now I
want to be able to delete the rows with a "" value. I have tried to write a
Do/Until loop to look at each row in the table, but I cannot figure out how
to word the statement telling it what to do when it encounters the "" values.
|