VBA PasteValues

Noz2k

Well-known Member
Joined
Mar 15, 2011
Messages
693
Basically I have a range of values which I want to copy from 1 sheet into another row on a mastersheet, but I can't seem to get it to work.

Here is my code currently

Code:
If Sheets(p).Range("S3") = "Total" Then
    Sheets(p).Range("C" & rng1, "Q" & rng1).Copy wsm.Range("C1").Offset(X, 0).PasteSpecial(xlPasteValues)
    Sheets(p).Range("S" & rng1).Copy wsm.Range("AE1").Offset(X, 0).PasteSpecial(xlPasteValues)
ElseIf
Etc, Etc
End If

Where p is the sheet name to copy from, rng1 is the row to copy and X is the row to paste to.

Have googled this and found a couple of suggestions which don't seem to work for me.
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Try like this

Code:
If Sheets(p).Range("S3") = "Total" Then
    Sheets(p).Range("C" & rng1, "Q" & rng1).Copy
    wsm.Range("C1").Offset(X, 0).PasteSpecial xlPasteValues
    Sheets(p).Range("S" & rng1).Copy
    wsm.Range("AE1").Offset(X, 0).PasteSpecial xlPasteValues
ElseIf
 
Upvote 0
Thanks, have actually just left work but will try both solutions out on Monday morning, cheers for the help
 
Upvote 0

Forum statistics

Threads
1,224,543
Messages
6,179,429
Members
452,914
Latest member
echoix

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