Copying data from one workbook to the last row or another

Vbanoob98

Board Regular
Joined
Sep 13, 2019
Messages
128
Hi everyone,

Here is the code I have so far:

Sub ValuePaste()
Dim loLastRow As Long

ThisWorbook.ActiveSheet.Range("E9").Copy

With Workbooks("test.xlsx").Worksheets("test")
loLastRow=.Cells(Rows.Count,3).End(xlUp).Row + 1
.Range("C & loLastRow).Paste.Special Paste:=xlPasteValues
EndWith

End Sub

What I want to add is a way to copy and paste more than one cell to another column
Like E11 to D, E14 to F, etc


I think it should be easy but Im having a hard time figuring out

Can anyone help?

Thanks in advance!
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Hi. Just copy the additional cells eg

Code:
Range("E9:F9").Copy

Plus your paste line is a bit wrong. Try:

Code:
.Range("C" & loLastRow).PasteSpecial xlPasteValues
 
Upvote 0
I'm trying to copy E1, E2, E3,etc to a new same line in another workbook

E1 goes in A2, E2 goes in B2, etc

But they all have to go in the same line. Is this possible?

Thanks for your help!
 
Upvote 0
Try the paste special like this:

Code:
.Range("C" & loLastRow).PasteSpecial Paste:=xlPasteValues, Transpose:=True
 
Upvote 0
Thanks a lot!

One more thing, how can I sum a range?

Like sum((e1:e2)+ (e4:e7)) and then pass that to the other worksheet
 
Upvote 0
fastest way is to perform the sum as you have listed above, than link that cell to the other worksheet or workbook even.
 
Upvote 0
Yeah sadly I can't edit the source data, so I have to do the calculation in vba. It seems that will be tough
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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