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



## Showroom (Dec 29, 2022)

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


----------



## Alex Blakenburg (Dec 29, 2022)

I am not a fan of linking workbooks but see if this does what you have in mind.


```
workbook1.sheet1.range("xxx").copy
workbook2.sheet2.range("yyy").Paste Link:=True
```


----------

