keeping original workbook open when saving
I think this is generally a good idea - saves having to save the original
book, save it with a new name, somehow restore back to the saved original
without deleted rows, and go through those hoops each time deleting a new set
of rows is required.
I might even go so far as to suggest creating a new workbook via
WorkBooks.Add and copying the sheet into the new book, doing the manipulation
on the copy of the sheet in the new book, saving the new book under whatever
name is required.
I'll work up some example code later this evening - pressed for time right
now.
"Bernie Deitrick" wrote:
Steven,
Generally:
Copy the sheet or sheets to a new workbook, then do the processing, and use the SaveAs command, then
close the newly saved book. For example:
Sub MakeCopyEditAndSave()
ThisWorkbook.Sheets("Sheet1").Copy
'Do processing here - call macro or put code
ActiveWorkbook.SaveAs Filename:= _
"C:\Whatever\" & NameString & ".xls" _
, FileFormat:=xlNormal
ActiveWorkbook.Close
End Sub
But if you have a specific logic for the row deletion, you might be able to automate the whole
process.....
HTH,
Bernie
MS Excel MVP
"steven" wrote in message
...
hello,
i work on a master workbook where a macro deletes rows from a worksheet.
After deleteing the rows I want the resulting workbook to be saved with a
specific filename.
I am able to go this far but then the I want to be able to revert to the
master workbook (prior to the rows being deleted) and run another macro for
different rows to be deleted and save the new file with another filename. And
then revert again ect.
How can I acomplish this? Cause my macro results to the master workbook to
be closed with the active worbook beng the saved worbook.
Thank you,
Steven.
|