copying to another workbook

ashani

Active Member
Joined
Mar 14, 2020
Messages
345
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

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
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,214,814
Messages
6,121,711
Members
449,049
Latest member
THMarana

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