I have some pretty cool code set up that will automatically run when a workbook opens depending on the file name. I want to be able to compare each word of each name in two different workbooks and if any of the words in the name match, do something.
EX1:
Workbook one is named, "FL HOME MARKET 1-21-19"
Workbook two is named, "FLORIDA HOME MKT 1-21-19"
Code fires when "HOME" is matched between two workbooks
EX2:
Workbook one is named, "FLA HOM MARKET 1-21-19"
Workbook two is named, "FLORIDA HOME MARKET 1-21-19"
Code fires when "MARKET" is matched between two workbooks
The names might change at times so I want it to compare each word and if any match then fire.
Right now I have everything set to match the names based on the first word using LEFT but it's clunky and I usually just end up changing the file names before I open them.
(JUSY FYI: I regularly work with different reports from different departments that are named similarly but not exactly identical)
EX1:
Workbook one is named, "FL HOME MARKET 1-21-19"
Workbook two is named, "FLORIDA HOME MKT 1-21-19"
Code fires when "HOME" is matched between two workbooks
EX2:
Workbook one is named, "FLA HOM MARKET 1-21-19"
Workbook two is named, "FLORIDA HOME MARKET 1-21-19"
Code fires when "MARKET" is matched between two workbooks
The names might change at times so I want it to compare each word and if any match then fire.
Right now I have everything set to match the names based on the first word using LEFT but it's clunky and I usually just end up changing the file names before I open them.
(JUSY FYI: I regularly work with different reports from different departments that are named similarly but not exactly identical)
Last edited: