Hi,
I am creating mailto:-links that are way to long, so they return "#Value" if I use =HYPERLINK().
I Have found this Sub, but I'm not experienced enough to modify it.
This is what I want to modify:
Greatly appreciate your help
I am creating mailto:-links that are way to long, so they return "#Value" if I use =HYPERLINK().
I Have found this Sub, but I'm not experienced enough to modify it.
Code:
Sub HyperlinkMaker()
'Code assumes column A and B values will be concatenated and used to make a hyperlink
'The hyperlink will be put in column C
Dim i As Long, firstRow As Long, lastRow As Long
Dim sFriendly As String, sHyperlink As String
firstRow = 2 'Put first hyperlink on this row
With ActiveSheet
lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row 'Look at last cell in column A with data
For i = firstRow To lastRow
sHyperlink = .Cells(i, "A").Value & .Cells(i, "B").Value 'Build the hyperlink
sFriendly = .Cells(i, "B").Value 'Display the "Friendly" value instead of full hyperlink
If sHyperlink <> "" Then .Hyperlinks.Add anchor:=.Cells(2, 3), Address:=sHyperlink, TextToDisplay:=sFriendly
Next
End With
End Sub
This is what I want to modify:
- Only run on 'Sheet1'.
- Continue to next row (now it only run on row 2.)
- Stop if cell in same row in 'Sheet2' is blank
Greatly appreciate your help