May 26 2019 08:16 AM
Fairly straightforward question, hopefully.
Does anyone know how to use the value of a cell to link to another worksheet in the same workbook, so if the value of the cell changes, the formula using it links to a different worksheet.
Say if cell A1 on Sheet1 contained the text Sheet2 and other formulas referenced A1 to link to Sheet2, but if the value of A1 was changed to Sheet6 then the formulas would look there instead.
I hope that makes sense, but if it doesn't, then I'm sorry!
Cheers
Phil
May 26 2019 09:07 AM
Hi Phil,
you can do this with worksheet_change event. See attached file.
Private Sub Worksheet_Change(ByVal Target As Range)
With ActiveSheet
.Range("A1").Hyperlinks.Delete
.Hyperlinks.Add Anchor:=.Range("A1"), Address:="", SubAddress:= _
.Range("A1").Value & "!A1", TextToDisplay:=.Range("A1").Value
End With
End Sub
Regards
Bernd
May 26 2019 01:02 PM