PDA

View Full Version : Code to Filter, Copy, Paste and Save Data



pliskers
08-11-2009, 07:30 PM
I have a file with two tabs: One contains a list of Cost Centers (call it "List"), and another containing cost data (call it "Data").

I need code that will run a loop to sequentially, for each Cost Center in the list:

1) Filter the data in the "Data" tab on a cost center field set to the Cost Center's number,
2) Copy the filtered data
3) Open a new Excel file and paste the data into cell A1,
4) Save the new file with the Cost Center in the file name and then close the file, and then
5) Go back to the Cost Center "List" tab and perform the same sequence on the next item in the list, until there is a file saved with the data filtered for each cost center.

I have a general idea, but am only moderately familiar modifying code, so would appreciate some help with this ASAP.

Thanks in advance for anyone's assistance!

MaximS
08-12-2009, 06:39 AM
Can you please post sample workbook with some date before and after?

pliskers
08-12-2009, 11:01 AM
I've not been asked to do that before - is there a way to upload a small Excel file or can I just paste in a screen shot?

MaximS
08-13-2009, 04:26 AM
Of course there is a way to do it - instead of 'Post Quick Reply' use 'Go Advanced' where you will find attachment management.

Without the sample file its hard to imagine how you data structure looks like, what do you need to filter, etc.