Quickly remove items which aren't on a list VBA

termeric

Active Member
Joined
Jun 21, 2005
Messages
280
Hello, i have a roster with all of people in my organization, and i want to be able to delete people who are not in a particular department. i am running my report several times for different departments, and each department has a varying number of teams with in it, for example;

Department A
Unit 10035
Unit 10037
Unit 10081
Unit 11011
Unit 11843
Unit 12716

Department B
Unit 18801
Unit 19515
Unit 21286

The department that i want to keep is on the Map tab, with thier individual ID in column D. for each department, i am restoring the full roster to the tab before removing the units which are not included on the current list, becasue at the end i am generating a file for each department.

The roster tab with the matching unti ID is in column G. How can i quickly loop through each row on Roster and keep only those which have a coresponding unit on my map tab?
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

Forum statistics

Threads
1,215,081
Messages
6,123,016
Members
449,093
Latest member
ikke

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