Save Sheets As Workbooks

plep654321
04-19-2004, 10:01 AM
Hello,

I have a program which saves seperate share ticker price data into a single workbook and then seperates each share in my porfolio by different sheet.
I.E sheet 1 is IBM, Sheet2 is Microsoft etc...

I have another program which requires share price info in CSV format and each Share to be in a seperate file with the Filename being the share name.

How can i run a macro that will select each individual sheet save it as a csv file then move on to the next sheet.

Thx

P

rick_deacha
04-19-2004, 10:26 AM
to give you a start point you could do something like


Sub AllSheets()
Dim WS as Worksheet
For each WS in Worksheets
'Your code for saving in CSV
Next
End Sub

Rollin
04-19-2004, 01:24 PM
Use a loop and copy each sheet to its own workbook and then save as a .CSV file. Here is the basic code to get you going. If you don't want to get any prompts after closing the newly created .CSV file just add the line Application.DisplayAlerts = False to the code.


Public Sub CSV()

For i = 1 To Sheets.Count
Sheets(i).Copy
ActiveSheet.SaveAs "C:\" & ActiveSheet.Name, xlCSV
ActiveWorkbook.Close
Next i

End Sub



Rollin

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum