30 Advanced Excel Tips for 2026

Excel Champs / VBA / Paste Values using a VBA Code in Excel
By Puneet Gogia (Microsoft MVP)

Paste Values using a VBA Code in Excel

30+ Advanced Excel Tips for 2026

No spam. Only Excel Stuff. God Promise. 😊

The quickest way is to assign the values directly, without the clipboard: Range("C1:C10").Value = Range("A1:A10").Value. Both ranges must be the same size; a larger destination fills the extra cells with #N/A, and a smaller one drops the rest without a warning.

To match the size automatically, resize the destination from the source:

Dim src As Range
Set src = Worksheets("Data").Range("A1:D50")
Worksheets("Report").Range("B2").Resize(src.Rows.Count, src.Columns.Count).Value = src.Value

To use Paste Special instead, copy, paste with xlPasteValues, then clear the copy mode:

Range("A1:A10").Copy
Range("C1").PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False

Pasting values into unformatted cells loses the look of dates and percentages: a date shows as a number such as 46314. Use xlPasteValuesAndNumberFormats to keep the number format, or format the destination first.

In Excel, by using a VBA code, there are two ways to paste values from one cell or a range to another. The first is the paste special method, which lets you paste only the values from one cell to another, just like Paste Values in Excel. The second is the Value property, which you can find later in this tutorial.

paste-values-using-vba-code

Let’s learn to write a code for this.

Only Paste Values using a VBA Code

The example below shows a value in cell A1 with the cell color and bold formatting. Now, to paste only the value in cell A3, we need to write a code:

  1. Refer to the cell from where you want to copy the values.
  2. Now, type a dot (.) and enter the copy method.
  3. After that, refer to the cell where you want to paste only the values.
  4. Next, enter the paste special method using a dot (.).
  5. Finally, type the starting parenthesis and select xlPasteValues from the drop-down.
vba-code-to-paste-valuess

You can see that when you run the code, it copies the value from cell A1 and pastes only the value to A3.

Sub paste_values()
Range("A1").Copy
Range("A3").PasteSpecial (xlPasteValues)
End Sub

This code has two lines, and it’s easy to understand how it works.

first-line-of-code

The first line of the code copies the value from cell A1. Here, you need to understand that when you copy a cell, it copies everything from that cell along with the value, like the formatting and the formula.

That’s why we need to use the paste special method in the second line to get the value only. In the paste special method, you can see multiple options to paste in the destination cell or a range.

pastespecial-method-in-vba

You can also use the argument in the following way:

argument-in-vba

In the above example, we have used the numeric value of xlPasteValues (-4163) to paste values to the destination range. Here, Paste:= names the argument, which is the standard way to write it.

Sub paste_values()

Range("A1").Copy

Range("A3").PasteSpecial Paste:=-4163

End Sub

Paste Values in a Range with a VBA Code

If you want to paste values to a range of cells, you need to refer to the range instead of a single cell.

paste-values-in-range-with-vba
Sub paste_values_2()

Range("A1").Copy

Range("A3:A7").PasteSpecial (xlPasteValues)

End Sub

We have referred to an entire range as the destination in the above code. So, the code copies the value from cell A1 and then pastes it to every cell in the range A3:A7.

In the example below, we have copied a range of cells and pasted it to a range with the same number of cells.

range-of-cells-pasted
Sub paste_values()

Range("A1:A3").Copy

Range("B1:B3").PasteSpecial (xlPasteValues)

End Sub

As you can see in the example, this code copies values from the range A1:A3 and pastes them to the range B1:B3.

You can also write this code in a way where you only specify the first cell of the range where you want to paste the copied values.

Sub paste_values()

Range("A1:A3").Copy

Range("B1").PasteSpecial (xlPasteValues)

End Sub

You can see that in the destination range, we have referred to cell B1, the starting cell of the range where we want to paste the values.

Paste Values with the Value Property

The second way to paste values doesn’t use copy and paste at all. You set the value of the destination cell equal to the value of the source cell. It doesn’t use the clipboard, so it’s faster, and it takes only one line of code:

Sub paste_values_property()
Range("A3").Value = Range("A1").Value
End Sub

For a range, the destination needs to be the same size as the source. If the destination range is bigger, the extra cells get the #N/A error. So, in the code below, both ranges have three cells:

Sub paste_values_range_property()
Range("B1:B3").Value = Range("A1:A3").Value
End Sub

If you only know the first cell of the destination, use Resize to make it the same size as the source range:

Sub paste_values_resize()
Dim src As Range
Set src = Range("A1:A3")
Range("B1").Resize(src.Rows.Count, src.Columns.Count).Value = src.Value
End Sub

Paste Values and Number Formats

When you paste only values, dates and percentages can show up as plain numbers in the destination. If you want to keep the number format with the values (but not the cell color or bold), use xlPasteValuesAndNumberFormats:

Sub paste_values_number_formats()
Range("A1:A3").Copy
Range("B1").PasteSpecial Paste:=xlPasteValuesAndNumberFormats
End Sub

PasteSpecial has two more arguments you can use with values: SkipBlanks (True to skip the blank cells in the copied range) and Transpose (True to turn rows into columns). For example, Range(“D1”).PasteSpecial Paste:=xlPasteValues, Transpose:=True pastes the values from a column into a row.

Paste Values to Another Sheet

To paste values on another sheet, refer to the sheet before the range. You don’t need to activate the sheet first. The code below copies the values from Sheet1 and pastes them in Sheet2:

Sub paste_values_another_sheet()
Worksheets("Sheet1").Range("A1:A3").Copy
Worksheets("Sheet2").Range("A1").PasteSpecial Paste:=xlPasteValues
End Sub

With the Value property, it’s one line: Worksheets(“Sheet2”).Range(“A1:A3”).Value = Worksheets(“Sheet1”).Range(“A1:A3”).Value.

Convert Formulas to Values

Sometimes you don’t want to paste the values somewhere else, but replace the formulas in a range with their results. For this, set the value of the range equal to its own value. The code below does this for the cells you have selected:

Sub convert_formulas_to_values()
Selection.Value = Selection.Value
End Sub

You can’t undo a macro with Ctrl + Z, so the formulas are gone once you run this code. Save a copy of the workbook first if you might need them.

Clear the Clipboard After Pasting

After you use the copy method, Excel keeps the moving border (marching ants) around the copied cells. To remove it, add this line at the end of your code:

Application.CutCopyMode = False

PasteSpecial Method of Range Class Failed Error

If you get run-time error 1004 with the message “PasteSpecial method of Range class failed”, most of the time there’s nothing on the clipboard to paste. This happens when the copy line is missing or when the copy mode is cleared before the paste line runs (for example, by Application.CutCopyMode = False in the wrong place). Make sure the copy line runs right before PasteSpecial. Or use the Value property, which doesn’t need the clipboard.

Which Method to Use

  • Value property: Use it for most tasks. It’s faster, doesn’t touch the clipboard, and works on another sheet without activating it.
  • PasteSpecial: Use it when you need the extra options, like values with number formats, skip blanks or transpose, or when you only know the first cell of the destination.

Frequently Asked Questions

What is the number for xlPasteValues?

The constant xlPasteValues has the value -4163, and xlPasteValuesAndNumberFormats has the value 12. Using the name makes your code easier to read, but both work the same way.

Does pasting values keep the formatting?

No. Both methods paste only the values, so the destination keeps its own formatting. Use xlPasteValuesAndNumberFormats if you also need the number format, or paste with xlPasteFormats as a second step if you need all the formatting.

How do I paste values below the last row?

Find the first empty cell under the data and paste there, like in the code below:

Sub paste_values_last_row()
Range("A1:A3").Copy
Cells(Rows.Count, "B").End(xlUp).Offset(1, 0).PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
End Sub
Puneet Gogia

Written by

Puneet Gogia

Microsoft MVP — Excel · Founder, Excel Champs

Twelve years of teaching Excel, and a decade before that using it as a data analyst. Every tutorial here is written from a file I actually built.

3M+ readers helped
1,000+ tutorials written
Since 2015 teaching Excel

Leave a Comment