Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 171
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 171
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hyperlink - Data Validation Alex Setting up and Configuration of Excel 0 March 2nd 08 08:36 PM
Non VB (simple VB) Hyperlink Data Validation List ric.todd Excel Discussion (Misc queries) 4 November 21st 06 08:56 PM
hyperlink in combo box/data validation Dannycol Excel Worksheet Functions 0 April 4th 06 11:23 PM
hyperlink validation list Stacie L. Excel Discussion (Misc queries) 1 December 7th 05 02:47 PM
data validation and using hyperlink to email Anastassia Excel Worksheet Functions 0 May 14th 05 09:55 AM


All times are GMT +1. The time now is 08:23 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"