Bitoku
Bitoku

Reputation: 23

Copy/Paste with link

I need to copy/paste a range with link.

I know it is with the Link:=True, but I Don't know how to modify my code to put it in.

Sheets("Remboursement").Select 'select the sheet to copy
Dim maplage As Range ' set range
Set maplage = Range("B2:E140").SpecialCells(xlCellTypeVisible) 
maplage.Copy 'copy only visible cells
With Sheets("Controle")
        .Activate ' activate the destination sheet
        .Range("T3").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _ 'paste the values
                              SkipBlanks:=False, Transpose:=False
End With
Set maplage = Nothing

I tried with :

.Range("T3").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
                              SkipBlanks:=False, Transpose:=False

But as usual, it doesn't work. It is a part of a long code that I made in 1 month, so I am little bit afraid to change it, that's why I ask to you first.

Upvotes: 0

Views: 655

Answers (1)

BigBen
BigBen

Reputation: 49998

Range.PasteSpecial does not have a Link parameter.

You are looking for Worksheet.Paste:

This is one of the few cases where you do need to Select, per the documentation...

If this argument (Link) is specified, the Destination argument cannot be used.... If you don't specify the Destination argument, you must select the destination range before you use this method.

With Sheets("Controle")
     .Activate
     .Range("T3").Select
     .Paste Link:=True

Upvotes: 3

Related Questions