Forum Discussion
Phil_Turton
May 26, 2019Copper Contributor
Using cell value to link to a different worksheet
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
2 Replies
- BerndvbatankerIron Contributor
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 SubRegards
Bernd
http://www.vba-Tanker.com
- Phil_TurtonCopper Contributor