Results 1 to 3 of 3
  1. #1
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    La Jolla, CA
    Posts
    1,470
    Thanks
    30
    Thanked 62 Times in 58 Posts

    Removing leading numbering from link

    I have a column of cells that contain hyperlinks to sites. When I copied this from a web page, each site was numbered and the numbering was part of the displayed link.

    I don't want to edit each display to remove the numbering, but want it removed and the links to remain.

    Any thoughts on a simple way?

  2. #2
    Gold Lounger Maudibe's Avatar
    Join Date
    Aug 2010
    Location
    Pa, USA
    Posts
    2,637
    Thanks
    115
    Thanked 650 Times in 592 Posts

    Split function

    Kw,

    Place this code in a standard module and the worksheet with the hyperlinks active. Replace StartRow and FinishRow with the range of the rows and Column with the column number of the range. Substitute the ". " with the common delimiter and then run the code. It will split then remove the initial portion of the hyperlink (the number) before the delimiter while keeping the link intact.
    ex: 1. Prepare the field ==> Prepare the Field

    Note: This will only work it the delimiter is consistent in each hyperlink

    HTH
    Maud

    Code:
    Sub SplitHyperlink()
    On Error Resume Next
    Dim stext As Variant
    
    '*****Replace these values******
    StartRow = 1
    FinishRow = 10
    Column = 2
    delimiter = ". "
    '*******************************
    
    For I = StartRow To FinishRow
        stext = Split(Cells(I, Column).FormulaR1C1, delimiter)
        Cells(I, Column).Hyperlinks(1).TextToDisplay = stext(1)
    Next I
    
    End Sub
    Last edited by Maudibe; 2013-06-23 at 09:25. Reason: renamed macro

  3. The Following User Says Thank You to Maudibe For This Useful Post:

    kweaver (2013-06-21)

  4. #3
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    La Jolla, CA
    Posts
    1,470
    Thanks
    30
    Thanked 62 Times in 58 Posts
    Fantastic. Thanks!

Posting Permissions

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