Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 13
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Linking makes filter macro not work dzelnio Excel Discussion (Misc queries) 0 June 14th 07 08:30 PM
Filter the results of a list based on a previous vlookup against the same list Mizpah Excel Worksheet Functions 2 August 18th 06 10:28 AM
Filter does not work cj21 Excel Discussion (Misc queries) 3 March 30th 06 02:48 PM
I wish to save my Excell work in my work sheets CLC 37 Qld Excel Worksheet Functions 0 May 24th 05 10:56 AM
Is there away to keep "auto save" from jumping to the first work sheet in the work book? Marc New Users to Excel 2 April 21st 05 01:27 AM


All times are GMT +1. The time now is 12:19 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"