Hyperlink - Data Validation

A

Alex

Hi,

I have cell A1 display values based on data validation from a list that is
column B.

The values in column B are hyperlinked to different web address.

Is there a way to have cell A1 display tthe hyperlink when a value is
selected?

Maybe with a macro??

Thanks
Alex
 
M

Mark Ivey

I am not totally sure of your layout, but here is something you might can
work with to get to where you want it to go.
It will probably need some modification to do what you want to do.

If I can help out more, just let me know...

Mark Ivey



Sub set_commentbox_to_display_hyperlink_info()
Dim myHyperlink As String

On Error GoTo hyper_Error

Range("A1").AddComment
Range("A1").Comment.Visible = False
myHyperlink = RETURNHYPERLINK(Range("B1"))
Range("A1").Comment.Text Text:=myHyperlink

On Error GoTo 0
Exit Sub

hyper_Error:
MsgBox "There is already a commentbox used here.", vbOKOnly

End Sub

Function RETURNHYPERLINK(Rng As Range) As String
If Rng.Hyperlinks.Count > 0 Then
RETURNHYPERLINK = Rng.Hyperlinks(1).Address

If Len(RETURNHYPERLINK) = 0 Then
RETURNHYPERLINK = Rng.Hyperlinks(1).SubAddress
End If
End If
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top