Copy sheet to new workbook as values

后端 未结 1 1825
后悔当初
后悔当初 2021-01-28 11:22

I want to copy the final input sheet of data workbook to a new workbook as only values

I\'ve tried this but it pastes the data as valu

相关标签:
1条回答
  • 2021-01-28 11:47
    Option Explicit
    
    Public Sub TestMe()
    
        Dim newWb As Workbook
        Dim newWbPath As String: newWbPath = ThisWorkbook.Path & "\NewWB.xlsx"
        Set newWb = Workbooks.Add
    
        ThisWorkbook.Worksheets("FinalCountDown").Cells.Copy
        newWb.Worksheets(1).Cells.PasteSpecial Paste:=xlPasteValues
        Application.CutCopyMode = False
    
        newWb.SaveAs newWbPath
        newWb.Close
    
    End Sub
    
    • It copies the cells from ThisWorkbook("FinalCountDown") to the first worksheet of a new Workbook.
    • Then the new workbook is named "NewWB.xlsx" and is saved in the same file as ThisWorkbook through the variable newWbPath.
    • At the end the newWb is closed with newWb.Close.
    0 讨论(0)
提交回复
热议问题