COPY IN VBA
Copy Method Example
Sheet1.Range("A1").Copy Destination:=Sheet2.Range("F2")
Cut Method Example
Sheet1.Range("A1").Cut Destination:=Sheet2.Range("F2")
Copy & PasteSpecial Method
expression.PasteSpecial(Paste, Operation (optional), SkipBlanks (optional TRUE/FALSE), Transpose (optional TRUE/FALSE)
Paste Can be;
xlPasteAll (default), xlPasteAllExceptBorders, xlPasteColumnWidths, xlPasteComments, xlPasteFormats, xlPasteFormulas, xlPasteFormulasAndNumberFormats, xlPasteValidation, xlPasteValues, xlPasteValuesAndNumberFormats
Operation (optional) Can be;
xlPasteSpecialOperationAdd, xlPasteSpecialOperationDivide, xlPasteSpecialOperationMultiply, xlPasteSpecialOperationNone (default), xlPasteSpecialOperationSubtract
Example
Sheet1.Range("A1").Copy
Sheet2.Range("F2").PasteSpecial Paste:= xlPasteValues, _
Operation:=xlPasteSpecialOperationAdd
Application.CutCopyMode=False'Clears clipboard.
Copy Formula Only Example
Sheet1.Range("A1").Formula= Sheet2.Range("F2").Formula
See also: Index to Excel VBA Code and Index to Excel Freebies and Lesson 1 - Excel Fundamentals and Index to how to… providing a range of solutions and Index to new resources and reference sheets
See also:
Microsoft ® and Microsoft Excel ® are registered trademarks of Microsoft Corporation. OzGrid is in no way associated with Microsoft.
Click here to visit our Free 24/7 Excel/VBA Help Forum where there are thousands of posts you can get information from, or you can join the Forum and post your own questions.