copying to another workbook

ashani

Active Member
Joined
Mar 14, 2020
Messages
346
Office Version
  1. 365
Platform
  1. Windows
Hi

I wonder if someone could please guide me, I'm looking to copy certain cells like a1, g3, c5 from the workbook - sheet Test to another workbook called Destination - sheet Test to first available row, from a1 to column b, g3 to column c and so on.

Please can someone guide me what syntax should I put in VBA.

I would like the Destination workbook to stay close.

Many 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.
I'm using the following code but the problem is :

1) it's not picking the first available row and keep overriding to the existing cells
2) Both workbooks have to be opened whilst I don't want to keep destination workbook open.
3) Also, don't want to describe the source workbook location, as it can be saved anywhere by the users

any help would be much appreciated.

VBA Code:
Sub copy()

Dim x As Workbook
Dim y As Workbook

Set x = Workbooks.Open("C:\Users\Desktop\Test.xlsm")
Set y = Workbooks.Open("C:\Users\Desktop\Test MI.xlsx")

x.Sheets("Coaching").Range("W4:AB4").copy
y.Sheets("Coaching Hub New").Range("A1").PasteSpecial Paste:=xlPasteValues

End Sub
 
Upvote 0

Forum statistics

Threads
1,215,410
Messages
6,124,755
Members
449,187
Latest member
hermansoa

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