Delete Line

S

Shawn

I need the code below altered so it deletes the entire row the blank cell is
in.

Dim xRange As Range
Dim xCell As Range

For Each xCell In Sheets("CDPTR").Range("A2:A25")
If xCell.Value = 0 Then
If xRange Is Nothing Then
Set xRange = xCell
Else
Set xRange = Union(xRange, xCell)
End If
End If
Next xCell
xRange.Delete Shift:=xlup
 
J

Jacob Skaria

Replace the last line of the code with

xRange.EntireRow.Delete

If this post helps click Yes
 
S

Shawn

Great. That works. I was using this code and it wasn't working:

Range("xRange" & ActiveCell.Row).EntireRow.Delete Shift:=xlUp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top