VBA to delete rows base on certain numbers in Column D

zone709

Well-known Member
Joined
Mar 1, 2016
Messages
2,129
Office Version
  1. 365
Platform
  1. Windows
Hi i have alot of delete row codes if cell is empty or even if certain columns have certain names.

What i need help on now is Delete entire row except for these numbers in Column D 74,70,113,13,69,115

Any help thanks
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
How about
Code:
Sub delRws()
With Range("D2", Range("D" & Rows.count).End(xlUp))
   .Value = Evaluate(Replace("if((@=74)+(@=70)+(@=113)+(@=13)+(@=69)+(@=115),@,"""")", "@", .Address))
   .SpecialCells(xlBlanks).EntireRow.Delete
End With
End Sub
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0
Hi im back one more thing i ran into. I need to also do this similar thing. Delete these rows with these numbers in D except for everything else.
 
Upvote 0
So instead of deleting everything except these numbers in D. I want to actually delete these rows with these number except everything else on my sheet. Its like the opposite
 
Upvote 0
In that case try
Code:
Sub delRws()
With Range("D2", Range("D" & Rows.count).End(xlUp))
   .Value = Evaluate(Replace("if((@=74)+(@=70)+(@=113)+(@=13)+(@=69)+(@=115),[COLOR=#ff0000]"""",@[/COLOR])", "@", .Address))
   .SpecialCells(xlBlanks).EntireRow.Delete
End With
End Sub
However any rows that are blank in col D will get deleted.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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