Create a hyperlink in an Excel cell?

Is it possible to create a hyperlink in an Excel cell that uses only a section of the cell text for a clickable link? I.E. Will the layout below the table represent something that can be easily built in Excel 2010?

layout http://dl.dropbox.com/u/14119404/misc/Microsoft%20Excel%20-%20Book1_2012-04-16_14-24-47.jpg

I know that an entire cell can easily be turned into a hyperlink, but not a specific part of the cell, as far as I know.

By hyperlink I also refer to

  • (a) another cell or
  • (b) the web URL.

thanks

+6
source share
4 answers

This is not possible in Excel. Hyperlinks are linked to whole cells.

If you look at the documentation for the Excel hyperlink object , you will see that it is associated with a range. If it was possible to link hyperlinks to a range within a cell, there would have to be a linked range and Symbols for the hyperlink object.

+3
source

After creating the hyperlink, you can format the text in the cell so that only the blue words are underlined. The hyperlink will still work, but obviously you can still have only one cell link, and clicking anywhere in the text will bring up the hyperlink.

For instance:

enter image description here

Sub Tester() Dim rng As Range Set rng = ActiveSheet.Range("A1") rng.Parent.Hyperlinks.Add Anchor:=rng, Address:="", SubAddress:= _ "Sheet1!A10", TextToDisplay:="this is long text" With rng.Font .ColorIndex = xlAutomatic .Underline = xlUnderlineStyleNone End With With rng.Characters(Start:=9, Length:=4).Font .Underline = xlUnderlineStyleSingle .Color = -4165632 End With End Sub 
+14
source

I needed to associate with the file name displayed in the cell, so this is what worked for me:

 ActiveSheet.Hyperlinks.Add Anchor:=Cells(row, column), Address:=file.Path, TextToDisplay:=file.Path 
+3
source

The above one liner was very useful ... since I am a beginner, I could not comment. So here is my option above, which takes each line in a worksheet and builds the URL from the value in the line.

 CHGRow = 3 Worksheets("Page 1").Select Cells(CHGRow, 1).Select Do Until Application.CountA(ActiveCell.EntireRow) = 0 URLVal = "https://our_url_here?some_parameter=" & Cells(CHGRow, cNumber) URLText = Cells(CHGRow, cNumber) ActiveSheet.Hyperlinks.Add Anchor:=Cells(CHGRow, cURL), Address:=URLVal, TextToDisplay:=URLText CHGRow = CHGRow + 1 Cells(CHGRow, 1).Select Loop 
0
source

Source: https://habr.com/ru/post/913370/


All Articles