Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Exporting subset of rows to multiple files


Hi,

I have a spreadsheet that contains report information for many clients
Unfortunately the same spreadsheet cannot be sent to all clients and
therefore have to export a subset of rows relating to each client an
then send each file separately. I do this using AutoFilter and nam
the file I create after a column name called Client Code, a simple tex
based field if no more than 8 characters.

Is this possible using VBA, if so how.

A basic set of column names would be Client Name, Client Code, Re
Number, Details.

Any help or guidance will be very much appreciated. Please let me kno
if you require any more info.


Thanks,
Da

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com

~~Now Available: Financial Statements.xls, a step by step guide to creating financial statements
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Exporting subset of rows to multiple files

Dan,

Make up a named range "List" that includes all the names that you
need. Then you can filter your range (in this example, A1:D1000)
based on the values in "List" and create new workbooks for each of
them. In the macro below, change the directory from C:\Excel in the
SaveAs line, and you're done.

HTH,
Bernie
MS Excel MVP

Sub ExportFilteredData()

Dim myCell As Range
Dim mySht As Worksheet
Dim myBook As Workbook
Dim sourceSht As Worksheet

Set sourceSht = ActiveSheet
Set myBook = ActiveWorkbook

For Each myCell In Range("List")
Set mySht = Sheets.Add(Type:="Worksheet")
With sourceSht.Range("A1:D1000")
.AutoFilter Field:=1, Criteria1:=myCell.Value
.SpecialCells(xlCellTypeVisible).Copy _
mySht.Range("A1")
End With
mySht.Move
ActiveWorkbook.SaveAs "C:\Excel\" & myCell.Value & ".xls"
ActiveWorkbook.Close
myBook.Activate
Next myCell
End Sub



"dororke" wrote in message
...

Hi,

I have a spreadsheet that contains report information for many

clients.
Unfortunately the same spreadsheet cannot be sent to all clients and

I
therefore have to export a subset of rows relating to each client

and
then send each file separately. I do this using AutoFilter and name
the file I create after a column name called Client Code, a simple

text
based field if no more than 8 characters.

Is this possible using VBA, if so how.

A basic set of column names would be Client Name, Client Code, Ref
Number, Details.

Any help or guidance will be very much appreciated. Please let me

know
if you require any more info.


Thanks,
Dan


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from

http://www.ExcelForum.com/

~~Now Available: Financial Statements.xls, a step by step guide to

creating financial statements


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Exporting subset of rows to multiple files


Bernie,

Excellent - thank you very much.

Dan


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

~~Now Available: Financial Statements.xls, a step by step guide to creating financial statements
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
Select Subset of Rows/Cols Joe Thompson Excel Discussion (Misc queries) 1 May 19th 10 05:41 AM
Importing data from several fles with different subset of rows [email protected] Excel Discussion (Misc queries) 1 February 28th 06 05:23 PM
How to enter symbols for subset or element of a subset in Excel? rwcita Excel Worksheet Functions 1 January 23rd 06 09:27 PM
Exporting multiple sheets to multiple htm files? [email protected] Excel Discussion (Misc queries) 4 April 2nd 05 01:26 PM
Exporting from Excel to multiple XML files Questions Excel Discussion (Misc queries) 0 March 17th 05 10:20 PM


All times are GMT +1. The time now is 07:38 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"