Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
K K is offline
external usenet poster
 
Posts: 108
Default Export Excel data as multiple files

I need to export a table of excel data with 2-3000 rows (records) and
10-15 columns (variable names) so that each 1 becomes an individual text
..csv file.

Any suggestions? many thanks
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,805
Default Export Excel data as multiple files

Do you want one file for each row?

"K" wrote:

I need to export a table of excel data with 2-3000 rows (records) and
10-15 columns (variable names) so that each 1 becomes an individual text
.csv file.

Any suggestions? many thanks

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Export Excel data as multiple files


Save as Pdf Files




--
Sahak
  #4   Report Post  
Posted to microsoft.public.excel.misc
K K is offline
external usenet poster
 
Posts: 108
Default Export Excel data as multiple files

Yes- 1 file for each row-

Thanks for responding-

"Sheeloo" wrote:

Do you want one file for each row?

"K" wrote:

I need to export a table of excel data with 2-3000 rows (records) and
10-15 columns (variable names) so that each 1 becomes an individual text
.csv file.

Any suggestions? many thanks

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Export Excel data as multiple files

Is a macro ok?

Option Explicit
Sub testme()
Dim FirstRow As Long
Dim LastRow As Long
Dim iRow As Long
Dim CurWks As Worksheet
Dim TempWks As Worksheet
Dim myPath As String
Dim myFileName As String
Dim fCtr As Long

Application.ScreenUpdating = False

Set CurWks = Worksheets("Sheet1")
Set TempWks = Workbooks.Add(1).Worksheets(1)

'this folder has to exist!
myPath = "C:\my documents\excel\test"
If Right(myPath, 1) < 1 Then
myPath = myPath & "\"
End If

With CurWks
FirstRow = 2 'headers in row 1???
'I used column A to determin the last row to process
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
fCtr = 0

For iRow = FirstRow To LastRow
Application.StatusBar = "Processing: " & iRow
fCtr = fCtr + 1
myFileName = Format(fCtr, "00000") & ".csv"
.Rows(iRow).Copy
TempWks.Range("a1").PasteSpecial Paste:=xlPasteValues

Application.DisplayAlerts = False
TempWks.SaveAs Filename:=myPath & myFileName, FileFormat:=xlCSV
Application.DisplayAlerts = True

TempWks.Cells.Clear 'probably not necessary, but it won't hurt
Next iRow
End With

TempWks.Parent.Close savechanges:=False

With Application
.StatusBar = False
.ScreenUpdating = True
End With
End Sub


K wrote:

I need to export a table of excel data with 2-3000 rows (records) and
10-15 columns (variable names) so that each 1 becomes an individual text
.csv file.

Any suggestions? many thanks


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.misc
K K is offline
external usenet poster
 
Posts: 108
Default Export Excel data as multiple files

Dave-
Thats really fantastic- Ill try it-Thanks for taking the time to help me
with that-best regards
"Dave Peterson" wrote:

Is a macro ok?

Option Explicit
Sub testme()
Dim FirstRow As Long
Dim LastRow As Long
Dim iRow As Long
Dim CurWks As Worksheet
Dim TempWks As Worksheet
Dim myPath As String
Dim myFileName As String
Dim fCtr As Long

Application.ScreenUpdating = False

Set CurWks = Worksheets("Sheet1")
Set TempWks = Workbooks.Add(1).Worksheets(1)

'this folder has to exist!
myPath = "C:\my documents\excel\test"
If Right(myPath, 1) < 1 Then
myPath = myPath & "\"
End If

With CurWks
FirstRow = 2 'headers in row 1???
'I used column A to determin the last row to process
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
fCtr = 0

For iRow = FirstRow To LastRow
Application.StatusBar = "Processing: " & iRow
fCtr = fCtr + 1
myFileName = Format(fCtr, "00000") & ".csv"
.Rows(iRow).Copy
TempWks.Range("a1").PasteSpecial Paste:=xlPasteValues

Application.DisplayAlerts = False
TempWks.SaveAs Filename:=myPath & myFileName, FileFormat:=xlCSV
Application.DisplayAlerts = True

TempWks.Cells.Clear 'probably not necessary, but it won't hurt
Next iRow
End With

TempWks.Parent.Close savechanges:=False

With Application
.StatusBar = False
.ScreenUpdating = True
End With
End Sub


K wrote:

I need to export a table of excel data with 2-3000 rows (records) and
10-15 columns (variable names) so that each 1 becomes an individual text
.csv file.

Any suggestions? many thanks


--

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
compiling data from multiple excel files compiling multiple excel files Excel Discussion (Misc queries) 1 April 21st 08 05:39 PM
Reading data arrays from multiple data files in excel Hankjam[_2_] Excel Discussion (Misc queries) 0 February 7th 08 08:29 PM
Export data from SQL into Excel files Kim[_3_] Excel Discussion (Misc queries) 2 October 31st 07 07:24 AM
Importing data from multiple excel files chewy Excel Discussion (Misc queries) 2 April 20th 07 03:24 PM
Extracting data from multiple excel files. helphelp Excel Discussion (Misc queries) 2 May 10th 06 09:45 PM


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