Excel VBA: Copy Cell Value And Paste To Another Cell - ExcelDemy

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.

Copy Cell Value and Paste to Another Cell.xlsm

Related Articles

  • How to Paste From Clipboard to Excel Using VBA
  • How to Copy Visible Cells Only without Header Using VBA
  • How to Use VBA PasteSpecial for Formulas and Formats in Excel
  • How to Use VBA PasteSpecial to Keep Source Formatting in Excel
  • Excel VBA: Copy Row If Cell Value Matches
  • Copy and Paste Values to Next Empty Row with Excel VBA
  • How to Autofilter and Copy Visible Rows with Excel VBA
Get FREE Advanced Excel Exercises with Solutions!

Từ khóa » Visual Basic Excel Copy Cell Value