VBA Delete Rows if 2 conditions are met

LNG2013

Active Member
Joined
May 23, 2011
Messages
466
Hello I need help with a bit of VBA code.

I need the code to look at Column AI.
Column AI can have a value of 0-7.
If a Row in Column AI has a value of "0" check column Notes, If it is empty delete that Row.

In the example below rows 4 & 5 would be deleted as they have an AI value = 0 and no Notes.


[TABLE="width: 500"]
<tbody>[TR]
[TD]1
[/TD]
[TD]Date
[/TD]
[TD]Team
[/TD]
[TD]AI
[/TD]
[TD]Match
[/TD]
[TD]Notes
[/TD]
[/TR]
[TR]
[TD]2
[/TD]
[TD]9/1/2019
[/TD]
[TD]Team 04
[/TD]
[TD]0
[/TD]
[TD]yes
[/TD]
[TD]checked
[/TD]
[/TR]
[TR]
[TD]3
[/TD]
[TD]9/5/2019
[/TD]
[TD]Team 01
[/TD]
[TD]4
[/TD]
[TD]yes
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4
[/TD]
[TD]9/7/2019
[/TD]
[TD]Team 05
[/TD]
[TD]0
[/TD]
[TD]no
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5
[/TD]
[TD]9/12/2019
[/TD]
[TD]Team 03
[/TD]
[TD]0
[/TD]
[TD]yes
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]6
[/TD]
[TD]9/15/2019
[/TD]
[TD]Team 07
[/TD]
[TD]2
[/TD]
[TD]yes
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]7
[/TD]
[TD]9/22/2019
[/TD]
[TD]Team 11
[/TD]
[TD]0
[/TD]
[TD]yes
[/TD]
[TD]checked
[/TD]
[/TR]
[TR]
[TD]8
[/TD]
[TD]9/30/2019
[/TD]
[TD]Team 09
[/TD]
[TD]1
[/TD]
[TD]no
[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


Thank you for any and all help!
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
You can use autofilter for that, just filter the AI column for 0 and the notes column for blanks & then delete the rows.
If you want the code, then use the recorder whilst you do it manually.
 
Upvote 0
You can use autofilter for that, just filter the AI column for 0 and the notes column for blanks & then delete the rows.
If you want the code, then use the recorder whilst you do it manually.

Thank you for your reply, unfortunately it is for a report I am building that others will be running and 2 additional conditions were just added too.
I will repost with additional conditions.

Thank you again.
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,161
Members
453,021
Latest member
Justyna P

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