ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   hyperlinks (https://www.excelbanter.com/excel-programming/436025-hyperlinks.html)

dstiefe

hyperlinks
 
I have a word in a cell that is a hyperlink

how do i use VBA to assign the URL of the hyperlink to a variable?

Thank you

Dave Peterson

hyperlinks
 
First, a single word in a cell that contains multiple words can't be assigned to
a hyperlink. The entire cell is assigned the hyperlink.

Dim myCell As Range
Dim myURL as string

Set myCell = ActiveSheet.Range("A1")

If myCell.Hyperlinks.Count 0 Then
myurl = myCell.Hyperlinks(1).Address
Else
myURL ""
End If


dstiefe wrote:

I have a word in a cell that is a hyperlink

how do i use VBA to assign the URL of the hyperlink to a variable?

Thank you


--

Dave Peterson


All times are GMT +1. The time now is 09:52 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com