Delete entire row base on two conditions

Panoos64

Well-known Member
Joined
Mar 1, 2014
Messages
890
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






<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>
[TD="class: xl65, width: 21, align: center"][/TD]
[TD="class: xl65, width: 22, align: center"]A[/TD]
[TD="class: xl65, width: 22, align: center"]B[/TD]
[TD="class: xl65, width: 22, align: center"]C[/TD]
[TD="class: xl65, width: 22, align: center"]D[/TD]
[TD="class: xl65, width: 22, align: center"]E [/TD]
[TD="class: xl65, width: 372, align: center"]F[/TD]
[TD="class: xl65, width: 29, align: center"]G[/TD]
[TD="class: xl65, width: 29, align: center"]H[/TD]
[TD="class: xl65, width: 29, align: center"]I[/TD]
[TD="class: xl65, width: 29, align: center"]J[/TD]

[TD="class: xl65, align: right"]28[/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"]Opening Balance PASTRIES & DELICATESSEN [/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65, align: right"]0[/TD]

</tbody>
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
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,223,892
Messages
6,175,236
Members
452,621
Latest member
Laura_PinksBTHFT

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