View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Sasikiran Sasikiran is offline
external usenet poster
 
Posts: 104
Default Macro to delete rows if...

Thank you so much... :)

"Jacob Skaria" wrote:

Hi Sasikiran

The below will only delete if 0's are present in G and H. Note the macro
will not delete blank rows....Try and feedback

Sub DeleteRows()
For lngRow = Cells(Rows.Count, "G").End(xlUp).Row To 1 Step -1
If Range("G" & lngRow).Text = "0" And Range("H" & lngRow).Text = "0" Then
Rows(lngRow).Delete
End If
Next
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Sasikiran" wrote:

Hello,

I need help with a macro that will delete certain rows in a spreadsheet.
The rows that need to be deleted are never in the same place, or the same
number of rows.

The row that need to be deleted will have a value 0 in two columns G & H.
Only if the value in the columns G & H is zero (0), the entire row should be
deleted. If either of the columns has value other than 0 it should remain in
the sheet.

Please suggest me on this.