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

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.

Forum statistics

Threads
1,223,714
Messages
6,174,044
Members
452,542
Latest member
Bricklin

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