Macro that compares strings and then actions

Tigerexcel

Active Member
Joined
Mar 6, 2020
Messages
493
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
I receive files that need updating based on whether personnel belong to a particular unit or have a particular characteristic.
Let's say that Tom, Jane and Andy don't need updating of their files but everyone else does. I'd like to create a macro that loops through all the records but leaves Tom, Jane and Andy's records intact. I can create a macro with an if statement that can test a value but I'm not sure how do that with a string. The macro would have to loop through a range of cells and then act if the name does not match a pre-defined list (or array?). I have run into this situation before where a macro that can do what I'm requesting would be useful for other situations so would appreciate any suggestions.
 
I don't know that I could have been more specific but anyway am using the sample data. Multiple cells refers to contents of C2 and C3, so will it handle both entries at once.
 
Upvote 0

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)

Forum statistics

Threads
1,214,990
Messages
6,122,625
Members
449,093
Latest member
catterz66

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