Can't believe I forgot this - Copy & Paste on same line?

RockandGrohl

Well-known Member
Joined
Aug 1, 2018
Messages
788
Office Version
  1. 2010
Platform
  1. Windows
For some reason I just have completely forgotten this. I'm trying to copy & paste on the same line to stop needing to activate sheets all the time.

VBA Code:
LastrowRep = Cells(Rows.Count, "B").End(xlUp).Row

Range("A7:A" & LastrowRep).Copy
cd.Activate
cd.Range("A" & Lastrow + 1).PasteSpecial xlPasteValuesAndNumberFormats
pg1.Activate
Range("C7:C" & LastrowRep).Copy
cd.Activate
cd.Range("B" & Lastrow + 1).PasteSpecial xlPasteValuesAndNumberFormats
pg1.Activate
Range("F7:F" & LastrowRep).Copy
cd.Activate
cd.Range("C" & Lastrow + 1).PasteSpecial xlPasteValuesAndNumberFormats
pg1.Activate
Range("S7:S" & LastrowRep).Copy
cd.Activate
cd.Range("D" & Lastrow + 1).PasteSpecial xlPasteValuesAndNumberFormats


Disgusting isn't it.

I want something that's more like
VBA Code:
Range("S7:S" & LastrowRep).Copy (cd.range("D" & Lastrow + 1)

Pasting formats or not doesn't really matter. But when I try what I want, it gives some error message, can't remember exactly what it says but it's the typical generic "That's not right" and I can't figure it out, it looks like it should work. I have the Workbook defined as "wb" but when I do wb.cd.range it doesn't work.

Thanks.
 

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.
VBA Code:
Range("S7:S" & LastrowRep).Copy cd.range("D" & Lastrow + 1)
 
Upvote 0

Forum statistics

Threads
1,214,927
Messages
6,122,309
Members
449,080
Latest member
jmsotelo

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