Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm looking to copy a worksheet from one Workbook to a new workbook,
but I don't want the Macros, Code or Forms to copy. Only the Worksheet Data. Any ideas? This is the code I'm currently using to create the new workbook. Sub CopySheets() Application.ScreenUpdating = False Dim ws As Worksheet, fileDate As String, bFirst As Boolean, wbkNew As Workbook Application.DisplayAlerts = False actwb = ActiveWorkbook.Name fileDate = Format(Date, "mm-dd-yy") filenm = (fileDate) & ".xls" 'assign the new workbooks names bFirst = True For Each ws In ThisWorkbook.Worksheets Select Case ws.Name Case "CHIP RESPONSE LOG", "DocuGrab", "CPC PROD LOG", "MODIFIER_GRID", "TCR PASS", "TCR DENIAL" 'these are the sheets names which shouldn't be copied Case Else If bFirst = True Then ws.Copy Set wbkNew = ActiveWorkbook Set VBComps = ActiveWorkbook.VBProject.VBComponents bFirst = False 'with the first sheet copied, create a new workbook Else ws.Copy After:=wbkNew.Sheets(wbkNew.Sheets.Count) 'add subsequent copies to the new workbook With ActiveWorkbook.VBProject End If End Select Next ws wbkNew.SaveAs Filename:=(fileDate) & ".xls" wbkNew.Close Application.DisplayAlerts = True Application.ScreenUpdating = True End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macros for Consolidating data in worksheet 1 on worksheet 2 | Excel Programming | |||
Move/Copy Worksheet with Macros | Excel Discussion (Misc queries) | |||
Mastersheet to Worksheet data copy - macros? | Excel Discussion (Misc queries) | |||
Macros: can you copy macros from one doc to another? | Excel Discussion (Misc queries) | |||
weird saving of a document with macros resulting with macros being transfered to the copy | Excel Programming |