Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Macro to work list in filter and save
Workbook A contains data relating to 300 towns. Column A contains the town
names. I need to split workbook A into several workbooks, each containing one towns data, and named the towns name. Currently I manually Filter by the town name, run a macro to copy the data to a new workbook and format it, the manually save by the town name. I want to include in my macro the running down each town name in the filter, then running the rest as per the existing macro, but finishing with saving the new workbook as town name, which is in cell A2. I cant figure out how to step to the next item in the filter, or how to save as a filename based on cell contents. Any help appreciated. -- Rich http://www.richdavies.com http://www.richdavies.com/profit-pro...ecruitment.htm |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Macro to work list in filter and save
If wks represents the worksheet that gets the new data (with the name in A2):
with wks 'stop any warning message if the file already exists application.displayalerts = false .parent.saveas filename:="C:\temp\" & .range("a2").value & ".xls", _ fileformat:=xlworkbooknormal application.displayalerts = true end with I put the file in C:\temp\ and overwrote any existing file with that name. And I didn't do any checking to see if that filename was valid. And no checking to see if the folder exists, either. Rich wrote: Workbook A contains data relating to 300 towns. Column A contains the town names. I need to split workbook A into several workbooks, each containing one towns data, and named the towns name. Currently I manually Filter by the town name, run a macro to copy the data to a new workbook and format it, the manually save by the town name. I want to include in my macro the running down each town name in the filter, then running the rest as per the existing macro, but finishing with saving the new workbook as town name, which is in cell A2. I cant figure out how to step to the next item in the filter, or how to save as a filename based on cell contents. Any help appreciated. -- Rich http://www.richdavies.com http://www.richdavies.com/profit-pro...ecruitment.htm -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Linking makes filter macro not work | Excel Discussion (Misc queries) | |||
Filter the results of a list based on a previous vlookup against the same list | Excel Worksheet Functions | |||
Filter does not work | Excel Discussion (Misc queries) | |||
I wish to save my Excell work in my work sheets | Excel Worksheet Functions | |||
Is there away to keep "auto save" from jumping to the first work sheet in the work book? | New Users to Excel |