Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Dec 2001
    Posts
    174
    Thanks
    0
    Thanked 0 Times in 0 Posts

    text to link (excel2000+)

    I want to convert column "A" (see attachment) to hyperlink using vba-- manually alI I have to do is press "F2" ie edit
    and then the esc key and then the text is recognized as a hyperlink (blue) also depends on autoformat setting. I want an independent way of doing the above.

    Many Thanx
    Smbs

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: text to link (excel2000+)

    The following macro will act on the selected cells.

    Sub Text2Link()
    Dim oCell As Range
    For Each oCell In Selection.Cells
    ActiveSheet.Hyperlinks.Add Anchor:=oCell, Address:=oCell.Value
    Next oCell
    End Sub

    You can easily adapt the macro to act on a specific range instead of the selection, if you prefer that.

  3. #3
    2 Star Lounger
    Join Date
    Dec 2001
    Posts
    174
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: text to link (excel2000+)

    As always thanx HansV--- I played with the problem for hours without success--I still don't fully understand how it works!
    Thanx
    Smbs

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: text to link (excel2000+)

    The macro loops through the cells in the selection. For each cell, the line

    ActiveSheet.Hyperlinks.Add Anchor:=oCell, Address:=oCell.Value

    adds a hyperlink to the active worksheet. The anchor of the hyperlink (the item you can click) is set to the cell, and the hyperlink address is set to the value (text) of the cell.

  5. #5
    2 Star Lounger
    Join Date
    Dec 2001
    Posts
    174
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: text to link (excel2000+)

    Thanx HansV
    Now I understand what the "anchor" means!!
    Smbs

Posting Permissions

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