Sheets

  • Thread starter Thread starter Steven Hook
  • Start date Start date
S

Steven Hook

Hey,
I have 16 sheets in a workbook, can I save it as one continuous CSV file, or
do I have to save each sheet indervidually?
Thanks
Steven
 
You could do either. If you do 16 separate saves, you'll get 16 separate .csv
files.

If you copy all 16 worksheets into a different worksheet, you could save that
and get just one .csv.

(You could even concatenate the 16 .csv files outside of excel and combine them
that way.)

I guess it depends on what you want.
 
Hi,
The only problem is that all 65536 rows of all 16 sheets are full, could I
join the csv files in somthing like notepad?
Steven
 
I'm not sure what you're going to do with 16*64k lines of .csv data (not bring
it back into excel I bet!), but if you save the files in a dedicated folder (no
other .csv files in that folder), you can save each sheet separately, then shell
to DOS and go to that folder.

Then use an old DOS command to concatenate the .csv files.

copy *.csv all.txt
(don't use .csv as the receiving file--DOS will try to concatenate that one, too
and it'll fail.)

Then (if you want):
ren all.txt all.csv

===
I would think using this old DOS command would be a lot faster than opening each
..csv file, selecting all, copy, paste into another notepad file (16 times).

===
And here's some getstarted code for saving all the sheets as .csv files.

Option Explicit
Sub testme()

Dim wks As Worksheet
Dim newWks As Worksheet

For Each wks In ActiveWorkbook.Worksheets
wks.Copy 'copies to a new workbook
With ActiveSheet
.Parent.SaveAs Filename:="C:\WINDOWS\TEMP\" & .Name, _
FileFormat:=xlCSV
.Parent.Close savechanges:=False
End With
Next wks

End Sub

(adjust the path to an existing, but empty folder)
 
Back
Top