VBA to Highlight Rows that Contain Any Keywords in Lookup Table

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

Thank you in advance!
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Table Name: KeywordLookupTable
Lookup Word
agost
Bauer
LUKAS
GeOrGe

Data Set (current active table)
SportNationalityNameAgeWt kgHt
Alpine SkiingPakistanABBAS Muhammad
23​
55​
168​
Figure SkatingUnited StatesABBOTT Jeremy
24​
175​
Freestyle SkiingUkraineABLAEV Enver
30​
68​
169​
Alpine SkiingGeorgiaABRAMASHVILI Iason
21​
82​
176​
Ice HockeyCanadaAGOSTA Meghan
23​
66​
168​
Speed SkatingSouth KoreaAHN Jee-Min
17​
52​
163​
Figure SkatingUnited StatesAGOSTO Benjamin
28​
178​
Cross-Country SkiingCzech RepublicBAUER Lukas
32​
73​
181​
SnowboardAustriaGRUENER Lukas
28​
80​
177​
Short TrackChinaSONG Weilong
20​
67​
179​
BiathlonPolandSZCZUREK Lukasz
21​
62​
178​
Freestyle SkiingFranceGEORGES Chloe
29​
57​
164​
Cross-Country SkiingSwedenLARSSON Mats
29​
80​
183​
Ice HockeyUnited StatesRAFALSKI Brian
36​
88​
178​
Cross-Country SkiingCanadaGREY George
30​
76​
179​

Output (Cell Color should be highlighted instead of the text)
SportNationalityNameAgeWt kgHt
Alpine SkiingPakistanABBAS Muhammad
23​
55​
168​
Figure SkatingUnited StatesABBOTT Jeremy
24​
175​
Freestyle SkiingUkraineABLAEV Enver
30​
68​
169​
Alpine SkiingGeorgiaABRAMASHVILI Iason
21​
82​
176​
Ice HockeyCanadaAGOSTA Meghan
23​
66​
168​
Speed SkatingSouth KoreaAHN Jee-Min
17​
52​
163​
Figure SkatingUnited StatesAGOSTO Benjamin
28​
178​
Cross-Country SkiingCzech RepublicBAUER Lukas
32​
73​
181​
SnowboardAustriaGRUENER Lukas
28​
80​
177​
Short TrackChinaSONG Weilong
20​
67​
179​
BiathlonPolandSZCZUREK Lukasz
21​
62​
178​
Freestyle SkiingFranceGEORGES Chloe
29​
57​
164​
Cross-Country SkiingSwedenLARSSON Mats
29​
80​
183​
Ice HockeyUnited StatesRAFALSKI Brian
36​
88​
178​
Cross-Country SkiingCanadaGREY George
30​
76​
179​
 
Upvote 0

Forum statistics

Threads
1,215,235
Messages
6,123,786
Members
449,125
Latest member
shreyash11

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