VBA to Highlight Rows that Contain Any Keywords in Lookup Table

Status
Not open for further replies.

seaottr

Board Regular
Joined
Feb 10, 2010
Messages
60
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi all,

I've scoured the internet for a solution and have tried coming up with a solution myself, but I'm just not proficient enough with VBA to be able to do it (and all of the solutions that I could find online involved a popup input box to manually enter keywords each time).

I'm trying to get a macro to look for any and all keywords in a table named "KeywordLookupTable" on another worksheet in a column called "Name" in the current active table and highlight the cell that contains it (or the entire row that contains it). The keywords should not be case sensitive and the list will be dynamic in the sense that I will change, add and delete keywords to be able to use in different data sets.

I don't want to use conditional formatting, as I would need to constantly recreate the rules for other files/data sets, and the file size would be a lot bigger as some of the data sets I use are huge.

I have sample data and keywords in the link to the spreadsheet below...if anyone is able to help me figure this out, I would be extremely appreciative!

Loading Google Sheets

Table Name: KeywordLookupTable
Lookup Word
agost
Bauer
LUKAS
GeOrGe

Data Set (current active table)
SportNationalityNameAgeWt kgHt
Alpine SkiingPakistanABBAS Muhammad2355168
Figure SkatingUnited StatesABBOTT Jeremy24175
Freestyle SkiingUkraineABLAEV Enver3068169
Alpine SkiingGeorgiaABRAMASHVILI Iason2182176
Ice HockeyCanadaAGOSTA Meghan2366168
Speed SkatingSouth KoreaAHN Jee-Min1752163
Figure SkatingUnited StatesAGOSTO Benjamin28178
Cross-Country SkiingCzech RepublicBAUER Lukas3273181
SnowboardAustriaGRUENER Lukas2880177
Short TrackChinaSONG Weilong2067179
BiathlonPolandSZCZUREK Lukasz2162178
Freestyle SkiingFranceGEORGES Chloe2957164
Cross-Country SkiingSwedenLARSSON Mats2980183
Ice HockeyUnited StatesRAFALSKI Brian3688178
Cross-Country SkiingCanadaGREY George3076179

Output (Cell Color should be highlighted instead of the text)
SportNationalityNameAgeWt kgHt
Alpine SkiingPakistanABBAS Muhammad2355168
Figure SkatingUnited StatesABBOTT Jeremy24175
Freestyle SkiingUkraineABLAEV Enver3068169
Alpine SkiingGeorgiaABRAMASHVILI Iason2182176
Ice HockeyCanadaAGOSTA Meghan2366168
Speed SkatingSouth KoreaAHN Jee-Min1752163
Figure SkatingUnited StatesAGOSTO Benjamin28178
Cross-Country SkiingCzech RepublicBAUER Lukas3273181
SnowboardAustriaGRUENER Lukas2880177
Short TrackChinaSONG Weilong2067179
BiathlonPolandSZCZUREK Lukasz2162178
Freestyle SkiingFranceGEORGES Chloe2957164
Cross-Country SkiingSwedenLARSSON Mats2980183
Ice HockeyUnited StatesRAFALSKI Brian3688178
Cross-Country SkiingCanadaGREY George3076179

Thank you in advance!
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Status
Not open for further replies.

Forum statistics

Threads
1,223,231
Messages
6,170,884
Members
452,364
Latest member
springate

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