Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 123
Default Save records from one file into seperate other files.

I have one master file with five fields

Field1 Field2 Field3 Field4 Filename
-- -- -- -- --
-- -- -- -- --
-- -- -- -- --
-- -- -- -- --
-- -- -- -- --

I need to create one excel file per record.

I need to paste A2 data into new file A2 cell, B2 data into new file B2 cell
and finally want to save the new file with filaname which is in E2

I need to repeat the entire process for each record.

As the output required is in excel i cannot use mailmerge. I tried to record
a macro and then put a loop but failed.

Please help me to solve this.

Thanks a lot in advance..
Boss


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default Save records from one file into seperate other files.

Boss
This macro will do that for you. I assumed a path to the destination
folder of:
C:\My Folder
Change this as needed. HTH Otto
Sub CreateFiles()
Dim FileName As String
Dim rColA As Range
Dim i As Range
Dim FullPath As String
Set rColA = Range("A2", Range("A" & Rows.Count).End(xlUp))
Application.ScreenUpdating = False
For Each i In rColA
FileName = i.Offset(, 4).Value
FullPath = "C:\My Folder\" & FileName & ".xls"
Workbooks.Add
i.Resize(, 4).Copy Range("A2")
ActiveWorkbook.SaveAs FileName:=FullPath
ActiveWorkbook.Close
Next i
Application.ScreenUpdating = True
End Sub
"Boss" wrote in message
...
I have one master file with five fields

Field1 Field2 Field3 Field4 Filename
-- -- -- -- --
-- -- -- -- --
-- -- -- -- --
-- -- -- -- --
-- -- -- -- --

I need to create one excel file per record.

I need to paste A2 data into new file A2 cell, B2 data into new file B2
cell
and finally want to save the new file with filaname which is in E2

I need to repeat the entire process for each record.

As the output required is in excel i cannot use mailmerge. I tried to
record
a macro and then put a loop but failed.

Please help me to solve this.

Thanks a lot in advance..
Boss




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 123
Default Save records from one file into seperate other files.

This was HEAVEN...

Thanks a lot.. !!
Boss

"Otto Moehrbach" wrote:

Boss
This macro will do that for you. I assumed a path to the destination
folder of:
C:\My Folder
Change this as needed. HTH Otto
Sub CreateFiles()
Dim FileName As String
Dim rColA As Range
Dim i As Range
Dim FullPath As String
Set rColA = Range("A2", Range("A" & Rows.Count).End(xlUp))
Application.ScreenUpdating = False
For Each i In rColA
FileName = i.Offset(, 4).Value
FullPath = "C:\My Folder\" & FileName & ".xls"
Workbooks.Add
i.Resize(, 4).Copy Range("A2")
ActiveWorkbook.SaveAs FileName:=FullPath
ActiveWorkbook.Close
Next i
Application.ScreenUpdating = True
End Sub
"Boss" wrote in message
...
I have one master file with five fields

Field1 Field2 Field3 Field4 Filename
-- -- -- -- --
-- -- -- -- --
-- -- -- -- --
-- -- -- -- --
-- -- -- -- --

I need to create one excel file per record.

I need to paste A2 data into new file A2 cell, B2 data into new file B2
cell
and finally want to save the new file with filaname which is in E2

I need to repeat the entire process for each record.

As the output required is in excel i cannot use mailmerge. I tried to
record
a macro and then put a loop but failed.

Please help me to solve this.

Thanks a lot in advance..
Boss





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
How do I save/update work to appear in 2 seperate files? Dodeka1 Excel Discussion (Misc queries) 2 December 14th 07 12:18 PM
save worksheets as seperate files (I know how to do it one by one) SANCAKLI Excel Discussion (Misc queries) 2 April 4th 07 01:39 PM
Save excel pages as seperate files iansa Excel Programming 4 November 23rd 06 10:06 PM
Save worksheet to seperate file? George Excel Discussion (Misc queries) 4 October 30th 06 08:30 PM
How to save each worksheet as seperate file? Henri Excel Programming 2 February 23rd 04 10:11 PM


All times are GMT +1. The time now is 03:16 AM.

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"