Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hyperlink - Data Validation
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hyperlink - Data Validation
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hyperlink - Data Validation
Forgot to give credit for the function...
I got this function from: http://www.dailydoseofexcel.com/arch...ry/vba-basics/ by Juan Pablo Gonzalez. Mark Ivey "Mark Ivey" wrote in message ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Hyperlink - Data Validation | Setting up and Configuration of Excel | |||
Non VB (simple VB) Hyperlink Data Validation List | Excel Discussion (Misc queries) | |||
hyperlink in combo box/data validation | Excel Worksheet Functions | |||
hyperlink validation list | Excel Discussion (Misc queries) | |||
data validation and using hyperlink to email | Excel Worksheet Functions |