Closed Thread
Results 1 to 3 of 3

How to create a Web Hyperlink based on Cell Contents?

Hybrid View

  1. #1
    Forum Contributor corinereyes's Avatar
    Join Date
    12-02-2003
    Location
    Philippines
    MS-Off Ver
    MS Excel 2016
    Posts
    520
    Hi chatguy

    You can try this code:

    Private Sub Worksheet_Activate()
    Dim stext As String
    
    stext = Worksheets("Sheet2").Range("C2")
    
    With Worksheets(2)
        .Hyperlinks.Add .Range("B2"), "http://www.google.com/search?q=" & stext
    End With
    End Sub
    In sheet 2, enter the following:
    B2 = google search
    C2 = Test (or any word you wish)

    Save the workbook, when sheet2 is activated, the above code runs.

    Hope it helps you get started.
    Corine

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Closed for cross posting on two other forums. Please read forum rules below and PM me if you agree to then

    VBA Noob
    Last edited by VBA Noob; 10-15-2007 at 04:31 PM.
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

Closed 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