+ Reply to Thread
Results 1 to 4 of 4

Conditional Hyperlinks?

  1. #1
    Forum Contributor
    Join Date
    07-02-2006
    Location
    Love City, USA
    Posts
    183

    Question Conditional Hyperlinks?

    Hi once again,

    Is Conditional Hyperlinks Possible?

    Example: Clicking on a Hyperlink may result in different Hyperlinks based
    on a cells value etc.

    If 'A1' = 'This' then open 'This' Hyperlink.
    If 'A1' = 'That' then open 'That' Hyperlink.

    Just Courious as to how this can be done.. Thanks..

  2. #2
    Forum Contributor
    Join Date
    12-12-2005
    Posts
    667
    Place a button on the sheet and assign it this macro:
    Sub Macro1()
    If Cells(1, 1) = "This" Then
    'Web hyperlink
    ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= _
    "http://www.google.com/", TextToDisplay:="Google"
    ElseIf Cells(1, 1) = "That" Then
    'File hyperlink
    ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= _
    "C:\This is it.txt", TextToDisplay:="Text"
    End If
    End Sub
    Best regards,

    Ray

  3. #3
    Forum Contributor
    Join Date
    07-02-2006
    Location
    Love City, USA
    Posts
    183

    Thumbs up Thanks Very Much!

    Thanks Ray! ... This Is very useful! I am going to play around with it
    a bit to grasp a better understanding on using it...

    This was very helpful.. Thanks Alot!

  4. #4
    Forum Contributor
    Join Date
    07-02-2006
    Location
    Love City, USA
    Posts
    183
    Ray, what would I change or take out of the Macro to have direct
    access to The File or link when it is ran?

    Example: Once the Macro is ran, and either condition is true, I want that
    condition carried out directly without the Anchoring of text.

    Thanks In Advance..

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1