Home

Using cell value to link to a different worksheet

Phil_Turton
New Contributor

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

@Phil_Turton 

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

www.vba-Tanker.com

@Berndvbatanker 

 

Hi Bernd,

Thanks for your help

Regards

Phil

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
38 Replies
Extentions Synchronization
Deleted in Discussions on
3 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
29 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
13 Replies