Ideas for VBA logic

normpam

Active Member
Joined
Oct 30, 2002
Messages
267
So, I've got a list of names in Column C, and in Column E a list of Departments, sorted in ascending order

John Smith 1
Mary Jones 1
Barry Sanders 2
Harry Stevens 3

I have already created VBA code to automatically add sheets and name them based on the list of departments. Now I would like to populate each sheet with the names from Column C, that correspond with the department numbers. So, for example, I need to put the first two names into the Sheet named 1, then Barry Sanders in the Sheet named 2, etc.

I have an idea about how to get it done, but am looking for better ways that would be more logical and simpler.

Any ideas are much appreciated!
 

Some videos you may like

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,218
Office Version
  1. 365
Platform
  1. Windows
You could use advanced filter to copy the names for each department to the relevant sheet.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,518
Messages
5,596,622
Members
414,082
Latest member
sasmita

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
Top