Vba add hyperlinks dynamically in Excel
To do it in Excel, here is the answer:
- Option Explicit
- Sub AddHyperlink()
- ActiveSheet.Hyperlinks.Add Anchor:=Range("AW5"), Address:="http://www.bbc.com", TextToDisplay:="BBC"
- End Sub
a) Line 3 above adds a Hyperlink to Range AW5, with text "BBC". The hyper link links to "http://www.bbc.com".
b) Suppose, the link has to be internal to the WorkBook, say cell A1 in a sheet named "BBC", the command can be modified as below -
ActiveSheet.Hyperlinks.Add Anchor:=Range("AW5"), Address:="", SubAddress:= "BBC!A1", TextToDisplay:="BBC"
You can find similar Excel Questions and Answer hereunder
1) What are the com addins in the developer tab of Excel
2) How do I copy a Table from one location to another and retain all formulas, formats and columnwidths?
3) I have a macro that takes a lot of time for execution - how can I keep the user informed that the macro is running?
4) Introduction to tables in Excel VBA and how to use tables, create tables in VBA
5) How can I set up ListBox using VBA to allow users to select multiple values?
6) How can I get users to select a folder to save the output of my macro?
7) How do I enter a formula in a cell using VBA (using Absolute Reference)?
8) How do I enter a formula in a cell using VBA (using Relative Reference)?
9) How can I add a Prefix to a set of numbers in a range?
10) How to do webscrapping in VBA. Here some basics