Saving sheets to new workbooks

D

Dave

If I have a spreadsheet with 30 or so Different sheets.
How can I copy these to New files and use the sheet name
as the new file name?
 
J

Jean-Guy Marcil

Hi Dave,

This is a Word newsgroup...
I am not Excel VBA expert, but I presume you would need something along the
lines of:
'_______________________________________
Sub Worksheet_to_Workbook()

Dim CurWbk As Workbook
Dim TarWbk As Workbook
Dim WkstToWbk As Worksheet
Dim WkstName As String
Dim WbkPath As String

Set CurWbk = ActiveWorkbook
CurWbk.Save
WbkPath = CurWbk.Path

For Each WkstToWbk In CurWbk.Worksheets
WkstName = WkstToWbk.Name
WkstToWbk.Copy
Set TarWbk = ActiveWorkbook
TarWbk.Close True, WbkPath & _
Application.PathSeparator _
& WkstName & ".xls"
Set TarWbk = Nothing
Next WkstToWbk

End Sub
'_______________________________________

But, you'd better check in an Excel newsgroup for more information.

HTH.

--
Cheers!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top