VBA: Copy from one workbook to an other, but keep link

Showroom

New Member
Joined
Feb 13, 2017
Messages
15
Hi guys

I have a problem, you might be able to help me with.

I have two workbooks. I am able to create a macro, which allow me to copy a range(table) from workbook1 and insert it in workbook2.

My code is very simple (just an example)

workbook1.sheet1.range("xxx").copy
workbook2.sheet2.range("yyy").PasteSpecial Paste:=xlPasteValues

Now. Here is my question. At the moment I am inserting as values. Can I somehow insert in a way, so if something is changed in workbook1, then the values in workbook2 is changed as well, without running the macro? (a link between the two workbooks)
You know, as one can do, when you have workbook2 open and write a function, where you refer to workbook1.

The only solution I can come up with, is if I write a line of code for every cell I want to copy. Then I will do a cell at a time, but in my head a quicker solution must exist, where I can copy a range and insert it in a way, where I keep the link? :)

Thank you
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
I am not a fan of linking workbooks but see if this does what you have in mind.

VBA Code:
workbook1.sheet1.range("xxx").copy
workbook2.sheet2.range("yyy").Paste Link:=True
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,155
Members
453,021
Latest member
Justyna P

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