如何Excel单元格concotenet文本网址点击打开浏览器中的网址链接?

时间:2018-01-22 16:35:41

标签: excel-vba vba excel

如何Excel单元格连接文本URL并单击以在浏览器中打开URL链接?

enter image description here

1 个答案:

答案 0 :(得分:1)

如果用以下内容替换Concatenate公式怎么样?

=HYPERLINK(CONCAT(A2:AA2))

<强>更新

如果您想使用VBA实现此目的并实际打开浏览器中的链接,那么以下内容将有所帮助:

Sub foo()
    Dim ws As Worksheet: Set ws = Sheets("Sheet1")
    'declare and set your worksheet, amend as required
    hyperlinkValue = Join(Application.Transpose(Application.Transpose(ws.Range("A2:AA2").Value)), "")
    'get the concatenated values into a variable
    ws.Range("AB3").Formula = "=Hyperlink(Concat(A2:AA2)," & """Click Here To Follow Link""" & ")"
    'enter the hyperlink into the Sheet in AB3
    ActiveWorkbook.FollowHyperlink Address:=hyperlinkValue
    'follow the hyperlink
End Sub