Paste Value Macro Help

tdixon

New Member
Joined
Nov 19, 2013
Messages
2
I am currently working on a macro to move specific rows of data from various sheets in a workbook onto a data sheet in the same workbook.

I'm using the below code that I lifted from an old post and modified slightly;

Sub cpynpst()
Dim sh4 As Worksheet, sh5 As Worksheet, lr As Long, rng As Range
Set sh4 = ActiveSheet
Set sh5 = Sheets("Data Sheet")
lr = sh4.Cells(Rows.Count, 1).End(xlUp).Row
Set rng = sh4.Range("9:20")
rng.EntireRow.Copy sh5.Cells(Rows.Count, 1).End(xlUp)(2)
End Sub

The issue I am having is that I need the data to be copied to the data sheet as values (i.e. paste special, paste values) and the macro currently copies the data formulas and all...

I am new to VBA and unfortunately lake the savvy to resolve this and would very much appreciate some help!
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Welcome to the board. Change this:
Code:
rng.EntireRow.Copy sh5.Cells(Rows.Count, 1).End(xlUp)(2)
to this:
Code:
rng.EntireRow.Copy 
sh5.Cells(Rows.Count, 1).End(xlUp)(2).PasteSpecial xlValues
 
Upvote 0
Try:
Code:
Sub cpynpst()
    Dim sh4 As Worksheet, sh5 As Worksheet, lr As Long, rng As Range
    Set sh4 = ActiveSheet
    Set sh5 = Sheets("Data Sheet")
    lr = sh4.Cells(Rows.Count, 1).End(xlUp).Row
    Set rng = sh4.Range("9:20")
    rng.EntireRow.Copy
    sh5.Cells(Rows.Count, 1).End(xlUp)(2).PasteSpecial xlPasteValues
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,509
Messages
6,125,215
Members
449,215
Latest member
texmansru47

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top