S
StargateFanNotAtHome
I had a light-bulb moment this morning to resolve a months-long
problem ... can Excel via a script split up a file by saving each
worksheet to a separate workbook and taking each new workbook's name
from the sheet's original tab name?
I've found a couple of somewhat similar requets here:
http://www.ozgrid.com/forum/showthread.php?t=14120, and here:
http://groups.google.ca/group/micro...=en&lnk=gst&q=split+workbook#8017ee2c1e6a95e2,
where the first one gives me an easier-looking script that seems
potentially more modifiable -- at least, to my less knowledgeable eyes
-- to what needs to be done <g>:
--------------------------------------------
Sub Movesheets()
' Macro by WillR
' www.ozgrid.com
Dim oldBook As Workbook
Dim newBook As Workbook
Set oldBook = ActiveWorkbook
Set newBook = Workbooks.Add
newBook.Activate
oldBook. Sheets("Sheet2").Copy after:=newBook.Sheets("Sheet2")
ActiveSheet. Name = "NewSheet"
ActiveWorkbook. SaveAs FileName:=Format( Date, "MMMMYY") &
"Report.xls"
--------------------------------------------
Of course, the difference is that this one saves only sheet 2 to a new
workbook and gives it a specific name where I need all the worksheets
to be saved to new, individual workbooks and to have them named by
their sheet name.
Thanks! D
problem ... can Excel via a script split up a file by saving each
worksheet to a separate workbook and taking each new workbook's name
from the sheet's original tab name?
I've found a couple of somewhat similar requets here:
http://www.ozgrid.com/forum/showthread.php?t=14120, and here:
http://groups.google.ca/group/micro...=en&lnk=gst&q=split+workbook#8017ee2c1e6a95e2,
where the first one gives me an easier-looking script that seems
potentially more modifiable -- at least, to my less knowledgeable eyes
-- to what needs to be done <g>:
--------------------------------------------
Sub Movesheets()
' Macro by WillR
' www.ozgrid.com
Dim oldBook As Workbook
Dim newBook As Workbook
Set oldBook = ActiveWorkbook
Set newBook = Workbooks.Add
newBook.Activate
oldBook. Sheets("Sheet2").Copy after:=newBook.Sheets("Sheet2")
ActiveSheet. Name = "NewSheet"
ActiveWorkbook. SaveAs FileName:=Format( Date, "MMMMYY") &
"Report.xls"
--------------------------------------------
Of course, the difference is that this one saves only sheet 2 to a new
workbook and gives it a specific name where I need all the worksheets
to be saved to new, individual workbooks and to have them named by
their sheet name.
Thanks! D