How to Delete entire rows by selecting different text in column A

D

Doug

I have a database that exports data to excel where duplicate and specific
data is deleted using macros.
My question is the data in column A uses multiple years of information.
Example

2009 2 Man Fall Senior Team Beall
2009 2 Man Fall Senior Team Beeghly
2008 2 Man Fall Senior Team Berish
2009 2 Man Fall Senior Team Blohm
2008 2 Man Fall Senior Team Brander
2008 2 Man Fall Senior Team Brown

Using the If function how do I either just use part of the cell, e.g. "Fall
Senior" or use the entire cell e.g. 2008 2 Man Fall Senior Team but use a
wild card character for the year e.g. 20?? 2 Man Fall Senior Team to delete
the entire row?

Any help would be appreciated.
 
D

Dave Peterson

You could use Like:
if ucase(mycell.value) like "*" & ucase("fall senior") & "*") then
if ucase(mycell.value) like ucase("20?? 2 Man Fall Senior Team") then

The asterisk represents 0 to lots of characters. The ? is a single character.


or you could use instr():
if instr(1, mycell.value, "fall senior", vbtextcompare) > 0 then
 
D

Doug

thanks Dave
either way works great
--
Doug
Small Business Databases


Dave Peterson said:
You could use Like:
if ucase(mycell.value) like "*" & ucase("fall senior") & "*") then
if ucase(mycell.value) like ucase("20?? 2 Man Fall Senior Team") then

The asterisk represents 0 to lots of characters. The ? is a single character.


or you could use instr():
if instr(1, mycell.value, "fall senior", vbtextcompare) > 0 then
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top