Copy and Paste or Equal Value

pwill

Active Member
Joined
Nov 22, 2015
Messages
406
Hi can anyone help?

I am copying data from "AJ2:AS & lRowAJ" to "N2:W & lRowAJ" and "X2:AG & lRowAJ"

If I use the following line it copies fine

[CODE
.Range("AJ2:AS" & lRowAJ).Copy
.Range("N2:W" & lRowAJ, "X2:AG" & lRowAJ).PasteSpecial Paste:=xlPasteValues][/CODE]

I would prefer to use the following line but I get errors in "X2:AG" is there something I can add to this line to have it equal the values in "AJ:AS"

[CODE
.Range("N2:W" & lRowAJ, "X2:AG" & lRowAJ) = .Range("AJ2:AS" & lRowAJ).Value][/CODE]

ie

NOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAKALAMANAOAPAQARAS
1NxtNxtNxtNxtNxtNxtNxtNxtNxtNxtNxtNxtNxtNxtNxtNxtNxtNxtNxtNxtNxtNxtNxtNxtNxtNxtNxtNxtNxtNxtNxtNxt
21012345671
#N/A######################N/A#N/A1012345671
3
4
5
6
7
8
9
10

<tbody>
</tbody>


Regards

pwill
 
Last edited:

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
dont know about the 1 liner but this is still better than copy/paste

Code:
.Range("N2:W" & lRowAJ).Value2 = .Range("AJ2:AS" & lRowAJ).Value2
.Range("X2:AG" & lRowAJ).Value2 = .Range("AJ2:AS" & lRowAJ).Value2
 
Upvote 0
Thanks JumboCactuar,

I just had the same idea myself lol works just the same, maybe someone else will come up with a one linner out of interest?

Thanks away much appreciated

pwill
 
Upvote 0

Forum statistics

Threads
1,213,532
Messages
6,114,177
Members
448,554
Latest member
Gleisner2

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