How to Copy a Cell Value and Paste it into Another Cell in Excel VBA – 3 Methods

Quick View:

Sub Copy_Single_Cell_Value()

Copy_Sheet = "Sheet1"
Copy_Cell = "B4"

Paste_Sheet = "Sheet2"
Paste_Cell = "B4"

Worksheets(Copy_Sheet).Range(Copy_Cell).Copy

Worksheets(Paste_Sheet).Range(Paste_Cell).PasteSpecial Paste:=xlPasteAll

End Sub

VBA Code to Copy a Cell Value and Paste to Another Cell


The sample dataset contains names, contact numbers, and the email addresses in Sheet1.

Data Set to Copy Cell Value and Paste to Another Cell Using Excel VBA

 

Method 1 – Copy a Single Cell and Paste It to Another Cell

  • Use the VBA code:
Sub Copy_Single_Cell_Value()

Copy_Sheet = "Sheet1"
Copy_Cell = "B4"

Paste_Sheet = "Sheet2"
Paste_Cell = "B4"

Worksheets(Copy_Sheet).Range(Copy_Cell).Copy

Worksheets(Paste_Sheet).Range(Paste_Cell).PasteSpecial Paste:=xlPasteAll

End Sub

VBA Code to Copy a Cell Value and Paste to Another Cell

  • Run the code. It’ll copy the value in B4 of Sheet1 (Boris Pasternak) to B4 of Sheet2.

Read More: How to Use VBA to Paste Values Only with No Formatting in Excel


Method 2 – Copy an Adjacent Range of Cells and Paste It into Another Range

  • Use the VBA code:
Sub Copy_Adjacent_Range_of_Cells()

Copy_Sheet = "Sheet1"
Copy_Range = "B3:D13"

Paste_Sheet = "Sheet2"
Paste_Range = "B3:D13"

Worksheets(Copy_Sheet).Range(Copy_Range).Copy

Worksheets(Paste_Sheet).Range(Paste_Range).PasteSpecial Paste:=xlPasteAll

End Sub

VBA Code to Copy Cell Value and Paste to Another Cell Using Excel VBA

  • Run the code. It’ll copy the values in B3:D13 of Sheet1 (Boris Pasternak) to B3:D13 of Sheet2.

Output to Copy Cell Value and Paste to Another Cell Using Excel VBA

Read More: Excel VBA to Copy Only Values to Destination


Method 3 – Copy a Non-Adjacent Range of Cells and Paste It into Another Range Using Excel VBA

  • Use the VBA code:
Sub Copy_Non_Adjacent_Range_of_Cells()

Copy_Sheet = "Sheet1"
Copy_Range = Array("B3:B13", "D3:D13")

Paste_Sheet = "Sheet2"
Paste_Range = "B3:C13"

Set Copy_Range2 = Worksheets(Copy_Sheet).Range(Copy_Range(0))

For i = 1 To UBound(Copy_Range)
    Set Copy_Range2 = Union(Copy_Range2, Worksheets(Copy_Sheet).Range(Copy_Range(i)))
Next i

Copy_Range2.Copy

Worksheets(Paste_Sheet).Range(Paste_Range).PasteSpecial Paste:=xlPasteAll

End Sub

  • Run the code. It’ll copy the values in B3:B13 and D3:D13 of Sheet1 to B3:C13 of Sheet2.

Read More: VBA Paste Special to Copy Values and Formats in Excel


Things to Remember

In this article, the xlPasteAll property of the PasteSpecial method was used.


Download Practice Workbook

Download the practice workbook.


Related Articles

Get FREE Advanced Excel Exercises with Solutions!
Rifat Hassan
Rifat Hassan

Rifat Hassan, BSc, Electrical and Electronic Engineering, Bangladesh University of Engineering and Technology, has worked with the ExcelDemy project for almost 2 years. Within these 2 years, he has written over 250 articles. He has also conducted a few Boot Camp sessions on effective coding, especially Visual Basic for Applications (VBA). Currently, he is working as a Software Developer to develop and deploy additional add-ins to enhance the customers with a more sophisticated experience with Microsoft Office Suits,... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo