Home |
Search |
Today's Posts |
#17
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You might want to know that in this scenario wksSource wasn't really
necessary since we could do this: Set wkbTarget = Sheets("overview").Copy ...then do whatever with wkbTarget. My point for using wksSource is that in some cases the formula refs may result in unexpected behavior when copied to a new wkb and so may require copying to the source wkb, convert formula results to constant values, then Move the sheet into wkbTarget. So then... Sub CopyOverview() Dim wksSource As Worksheet, wkbTarget As Workbook Dim SaveAsFilename As String, sWksName As String SaveAsFilename = ThisWorkbook.Path & "\Overview-" _ & FileNameDateString(IncludeNone) & ".xls" sWksName = Sheets("overview").Name Set wksSource = Sheets("overview").Copy After:=Sheets("overview") With wksSource .UsedRange.Value = .UsedRange.Value End With Set wkbTarget = wksSource.Move With wkbTarget .Sheets(1).Name = sWksName .SaveAs SaveAsFilename: .Close End With End Sub After which you're returned to the source wkb which should be closed without saving changes. If you're done with it after running the CopyOverview procedure then you can incorporate that into the process. Add var: Dim wkbSource As Workbook Set wkbSource = ActiveWorkbook At the end of the proc: wkbSource.Close SaveChanges:=False -- Garry Free usenet access at http://www.eternal-september.org ClassicVB Users Regroup! comp.lang.basic.visual.misc |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Export specific cell values to an external workbook | Excel Programming | |||
How to export a linked cell sheet to get only values. | Excel Programming | |||
Export Specific Sheet in Listbox to New Workbook | Excel Programming | |||
Export selected Sheet in a new workbook with old workbook name! | Excel Programming | |||
Export just one sheet from a workbook | Excel Programming |