Creating multiple files from an excel filter

robmaag

New Member
Joined
Aug 21, 2015
Messages
38
b. Take a spreadsheet that has in Column D a name for an entity: (for example, call it 'United Airlines')

b. Filter the data in spreadsheet by Column D (called United Airlines). Note there will be 56 of these queries...one after the other with diffrent names...

c. Delete all other data in Column D that is not United Airlines

d. Save the results into an excel file

e. Place the file in its own folder


Any thoughts?

Thanks
 
The file is being used by another progarm

The workbook you are tyring to save has the same name as a currently open workbook.

These are the new errors..
 
Upvote 0

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Actually, since the 31 character limit refers to the sheet name, I should have offered the following...

Code:
filteredSheet.Name = Left(sCleanFileName(criteriaCell.Value), 31)

The character limit for the path and filename is 218.
 
Upvote 0
Dominic or ALL,

Thank you for your help on this small project. I believe I found the problem.

The problem has to do with the uniqueness of the file name.

I think the above code is hanging on the following filter criteria:

MCKESSON
MCKESSON - VALLEY CARE IPA
MCKESSON - VALLEY CARE SELECT IPA

<tbody>
</tbody><colgroup><col></colgroup>

For some reason the truncation is thinking it is a duplicate..Perhaps we can place a number followed by an underline in front of each filter criteria generated?

Your thoughts...Please help ....:(
 
Upvote 0
How about adding a date and time stamp to each filename to ensure uniqueness? If so, try...

Code:
saveName = sCleanFileName(criteriacell.Value) & " " & Format(Now, "yyyy-mm-dd hh-mm-ss")

If the file extension already exists, try...

Code:
saveName = Replace(sCleanFileName(criteriacell.Value), ".xls", " " & Format(Now, "yyyy-mm-dd hh-mm-ss") & ".xls")

Change the file extension, accordingly.

Hope this helps!
 
Upvote 0

Forum statistics

Threads
1,216,350
Messages
6,130,139
Members
449,560
Latest member
mattstan2012

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