Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Delete an entire Row if 2 Columns = Zero Q

The code below deletes the entire row starting upwards from row 500 if the
value in H=0, but if E=VAT then ignore regardless if H in that particular
row = 0.

For i = Range("E500").End(xlUp).Row To 2 Step -1
If Left(Range("E" & i).Value, 3) < "VAT" Then
If Range("H" & i).Value = 0 Then
Range("H" & i).EntireRow.Delete
End If
End If
Next i


I wish to modify this slightly that even if E=VAT the row will still be
deleted if L=0. So in effect if H & L are "both" Zero, delete the entire
row. How would I do that

Thanks


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Delete an entire Row if 2 Columns = Zero Q

For i = Range("E500").End(xlUp).Row To 2 Step -1
If Left(Range("E" & i).Value, 3) < "VAT" or _
Range("L" & i).Value = 0 Then
If Range("H" & i).Value = 0
Range("H" & i).EntireRow.Delete
End If
End If
Next i

--
Regards,
Tom Ogilvy


"John" wrote in message
...
The code below deletes the entire row starting upwards from row 500 if the
value in H=0, but if E=VAT then ignore regardless if H in that particular
row = 0.

For i = Range("E500").End(xlUp).Row To 2 Step -1
If Left(Range("E" & i).Value, 3) < "VAT" Then
If Range("H" & i).Value = 0 Then
Range("H" & i).EntireRow.Delete
End If
End If
Next i


I wish to modify this slightly that even if E=VAT the row will still be
deleted if L=0. So in effect if H & L are "both" Zero, delete the entire
row. How would I do that

Thanks




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Delete an entire Row if 2 Columns = Zero Q

Thanks Tom

Just a "Then" missing from - If Range("H" & i).Value = 0


"Tom Ogilvy" wrote in message
...
For i = Range("E500").End(xlUp).Row To 2 Step -1
If Left(Range("E" & i).Value, 3) < "VAT" or _
Range("L" & i).Value = 0 Then
If Range("H" & i).Value = 0
Range("H" & i).EntireRow.Delete
End If
End If
Next i

--
Regards,
Tom Ogilvy


"John" wrote in message
...
The code below deletes the entire row starting upwards from row 500 if
the
value in H=0, but if E=VAT then ignore regardless if H in that particular
row = 0.

For i = Range("E500").End(xlUp).Row To 2 Step -1
If Left(Range("E" & i).Value, 3) < "VAT" Then
If Range("H" & i).Value = 0 Then
Range("H" & i).EntireRow.Delete
End If
End If
Next i


I wish to modify this slightly that even if E=VAT the row will still be
deleted if L=0. So in effect if H & L are "both" Zero, delete the entire
row. How would I do that

Thanks






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete entire row if David T Excel Discussion (Misc queries) 2 December 6th 06 10:14 PM
Delete Entire Row Tony P.[_3_] Excel Programming 3 May 18th 05 09:58 PM
Delete Entire Row If Q John Excel Programming 10 June 9th 04 03:02 PM
Another delete entire row Sean[_9_] Excel Programming 1 May 11th 04 04:41 PM
Delete Entire Row. Sam Excel Programming 5 December 21st 03 05:56 AM


All times are GMT +1. The time now is 02:43 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"