View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
michaelberrier
 
Posts: n/a
Default Saving worksheet in new file with date AND cell value as file name

That fixed my naming problem, but the other problem persists.

When the macro runs, I want to close, disregard or skip altogether the
"Book2" file. Using Thisworkbook.close tries to close the Master file,
which I want to keep open.

Here's the code I have now:
Sub copytofile()
'
' copytofile Macro
' Macro recorded 5/26/2006 by Michael Berrier
'

'
Sheets("MANIFEST").Select
Sheets("MANIFEST").Copy
Worksheets("MANIFEST").Copy 'to a new workbook
'new workbook is now active
With ActiveWorkbook
.SaveAs Filename:=.Worksheets("MANIFEST").Range("C13").Val ue &
Application.Substitute(Date, "/", "-")
.Close savechanges:=True 'if you're done with it.
ThisWorkbook.Close
End With
End Sub

Thanks.