Paste values only

G

GLHEC-BLS

I am trying to write code to paste the contents of a range of cells on sheet
1 to a range of cells on sheet 2 but all it is pasting is a #REF error. I
assume this is becuase it is pasting the formula in the cells on sheet 1 and
not the values only. Is their a pasteSpecial method to paste teh values of
the cells only?
 
B

BobT

Here's the line to add once you have selected where you want to paste.

Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
 
G

Gary''s Student

Sub Macro1()
Range("A1:D7").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
End Sub

right from the recorder
 
Top