sgrya1
sgrya1

Reputation: 37

Link excel cell to another sheet

I want to link cells to another sheet, not just copy cell values The code below is an attempt but tries to show what I need

For Each sheet In ThisWorkbook.Sheets
    Cells(Row, col).Formula = sheet.Cells(4, 5).Address
Next

Can someone help me here.

Upvotes: 1

Views: 229

Answers (1)

Oleg Belousov
Oleg Belousov

Reputation: 529

You must use sheet name and sign = like this:

Cells(Row, col).Formula = _
  "='" & sheet.Name & "'!" & sheet.Cells(4, 5).Address( _
    RowAbsolute:=False, ColumnAbsolute:=False)

Upvotes: 1

Related Questions