Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

Hyperlinks

0

If I have created a hyperlink and then insert a line in the original file, how do I get the hyperlink to update to the correct line number automatically?

Answer
Discuss

Answers

0

You speak in riddles, my friend. However, you can create a hyperlink using this function.

=HYPERLINK([Hyperlink address], [Name to display])

Both variables are strings (meaning text - and therefore enclosed in quotation marks). I tried this variation.

=HYPERLINK("https:/www.bing.com","My search")

Both variables can be obtained from referenced cells. That might look like this:-

=HYPERLINK($A$2,$C$1)

How this formula might know which is the "correct line number" is a secret yet to be lifted. However, it is thinkable that A2 could either hold a dropdown or be filled depending upon the selection from a dropdown and that C1 might have the same dependency or be the source itself. In that case you might select "Uncle Ed" from a drop-down in C1 which causes A2 to to display the address in B40 which might be "http:/www.Ancestors.com". The point is that you could use any of the myriad of ways Excel offers to vary the contents of both A2 and C1 thereby varying the function of a single hyperlink.

Observe in this regard that I suggest absolute addressing for the cells the hyperlink references. If you make the row address realtive, for example $B40) you could create a series of hyperlinks, each referencing another row, by copying the formula down to other cells.

Discuss


Answer the Question

You must create an account to use the forum. Create an Account or Login