excelvba

Excel VBA to copy entire sheet and paste as values


I am needing to create a VBA statement that will Copy the entire active sheet and then paste as values - seems pretty simple but I am not familiar with VBA - it would essentially be automating the 'click' in the top left and copy --> paste as values. here is what I am trying:

Sub CopyPasteSheetAsValues()
'Copy and Paste Summary Sheet as Values
Sheets("Summary Build").Cells.Copy
Sheets("Summary Build").Cells.PasteSpecial Paste:=xlPasteValue
End Sub

Solution

  • You miss an s in xlPasteValues. Also, good to add Application.CutCopyMode = False to avoid the marching ants around your copy area.

    Sub CopyPasteSheetAsValues()
        'Copy and Paste Summary Sheet as Values
        Sheets("Summary Build").Cells.Copy
        Sheets("Summary Build").Cells.PasteSpecial Paste:=xlPasteValues
        Application.CutCopyMode = False
    End Sub