View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Opal Opal is offline
external usenet poster
 
Posts: 2
Default Delete a row based on more than one condtion

On Aug 25, 7:38 pm, Barb Reinhardt
wrote:
Try this:

RngColAB(c).offset(0,1) 'One cell to the right
RngColAB(c).offset(1,0) 'One cell below

HTH,
Barb Reinhardt



If RngColAB(c).Value = 0 Then _

"Opal" wrote:
I am using the following code to delete a row in a spreadsheet based
on the value (zero) in that row:


Sub RemoveZero()
Dim RngColAB As Range
Dim c As Long
Application.ScreenUpdating = False
Set RngColAB = Range("AB2", Range("AB" & Rows.Count).End(xlUp))
For c = RngColAB.Count To 1 Step -1
RngColAB(c).Value = Application.Trim(RngColAB(c))
If RngColAB(c).Value = 0 Then _
RngColAB(c).EntireRow.Delete



Thank you, both. That worked really well.