Macro to Delete Rows (multiple criteria)

jakulski

New Member
Joined
Jan 17, 2017
Messages
15
I have a worksheet consisting of approximately 50,000 rows and 30 columns (A - AD). Each column has a heading. I need a macro that will quickly delete all rows that don't contain specific text in Column C. Column C will have names of schools, elementary, middle, and high. There are approximately 225 different school options to go in each row in Column C. For each macro, I will designate 35-45 schools to keep, with all other rows being deleted. ols. Let's say that for this example, I would like to keep all rows that contain any one of the following schools in Column C (SchName): Happy Valley Elementary; Rolling Thunder Middle; Betsy Ross High; and John Glenn High.
Lev
SchID
SchName
ID
FName
LName
Grade
Gender
Ethnic
Elig
1
1
Happy Valley Elementary
1234567
Humpty
Dumpty
3
2
2
Rolling Meadow Middle
2345671
Tom
Cat
8
3
3
Tuckman County High
3456712
Jerry
Maguire
10
4
2
Rolling Thunder Middle
4567123
Buzz
Light-Year
8
5
4
Tuckman County Middle
5671234
Peter
Brady
7
6
5
John Glenn High
6712345
John
Glenn
12

<tbody>
</tbody>
 
Last edited:
It means that you probably have either missed some quotes or (if you are using them) line continuations.

Post your code as you have it (in code tags) and I will look at it when I am in this evening.

As I implied it is probably better with the amount you have to put them in a range. Post if you want code for this as well.
 
Upvote 0

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Mark858- Never mind, I figured it out. I needed the underscores ( _ ). I'm self-taught with VBA and stumble my way through. Thank you so much for your help!
 
Upvote 0
Never mind, I figured it out. I needed the underscores

That's the line continuations I was on about :biggrin:
Can't remember if it is the correct term though.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,267
Messages
6,123,964
Members
449,137
Latest member
yeti1016

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