Delete entire row base on two conditions

Panoos64

Well-known Member
Joined
Mar 1, 2014
Messages
882
Hi all, i would like to prepare a VBA code so that to run through col. "F" and where the text is like "Opening Balance" and in col. "J" is zero number "0" should delete entire row. Please see below an extract of my data row "28" which i wanted to delete. Thank you all in advance





ABCDE FGHIJ
28Opening Balance PASTRIES & DELICATESSEN 0

<colgroup><col style="mso-width-source:userset;mso-width-alt:739;width:16pt" width="21"> <col style="mso-width-source:userset;mso-width-alt:796; width:17pt" width="22" span="5"> <col style="mso-width-source:userset;mso-width-alt:13226;width:279pt" width="372"> <col style="mso-width-source:userset;mso-width-alt:1024; width:22pt" width="29" span="4"> </colgroup><tbody>
</tbody>
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
How about
Code:
Sub Panoos64()
   With ActiveSheet
      If .AutoFilterMode Then .AutoFilterMode = False
      .Range("A1:J1").AutoFilter 6, "opening balance*"
      .Range("A1:J1").AutoFilter 10, "0"
      .AutoFilter.Range.Offset(1).EntireRow.Delete
      .AutoFilterMode = False
   End With
End Sub
 
Last edited:
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,214,643
Messages
6,120,702
Members
448,980
Latest member
CarlosWin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top