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

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.

Forum statistics

Threads
1,224,909
Messages
6,181,672
Members
453,061
Latest member
schiefA

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