handysmurf
Board Regular
- Joined
- Jan 17, 2015
- Messages
- 114
- Office Version
- 365
- Platform
- Windows
I have a sub to display the URL of a link for me. But it sometimes returns a 0 instead of the link.
Public Function GetURL(Cell As Range, Optional default_value As Variant) As Variant
Dim output As Variant
If (Cell.Range("A1").Hyperlinks.Count <> 1) Then
output = default_value
Else
output = Cell.Range("A1").Hyperlinks(1).Address
End If
GetURL = output
End Function
Help ... it's annoying.
Public Function GetURL(Cell As Range, Optional default_value As Variant) As Variant
Dim output As Variant
If (Cell.Range("A1").Hyperlinks.Count <> 1) Then
output = default_value
Else
output = Cell.Range("A1").Hyperlinks(1).Address
End If
GetURL = output
End Function
Help ... it's annoying.