Calling all excel experts: How do I extract hyperlinks from one cell to another?

Discussion in 'Programming' started by wing, Oct 17, 2008.

  1. #1
    Hello :)

    I have got an excel file with some data I want to export to mysql (I know how to do that). There are about 90 000 rows of data. The first column contains company names which are are hyperlinked.

    Before I import the dat to mysql I would need to extract the url's to another column in the excel sheet. I have found some code that could do the job
     Function HyperLinkText(pRange As Range) As String
                            Dim ST1 As String
                  Dim ST2 As String
                 If pRange.Hyperlinks.Count = 0 Then
       Exit Function
                  End If
                 ST1 = pRange.Hyperlinks(1).Address
                  ST2 = pRange.Hyperlinks(1).SubAddress
                 If ST2 <> "" Then
       ST1 = "[" & ST1 & "]" & ST2
                  End If
                 HyperLinkText = ST1
                          End Function
            
    Code (markup):
    But I can't find where/how insert this code and make it apply to to the spreadsheet. Anyone knows?

    Thanks for any input
     
    wing, Oct 17, 2008 IP
  2. jeremyposter

    jeremyposter Guest

    Messages:
    96
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I only know other language.. yours probably VB right
     
    jeremyposter, Oct 17, 2008 IP
  3. wing

    wing Active Member

    Messages:
    210
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    58
    #3
    I was into VB a loong time ago. Nowadays I work with php like everyone else :)
     
    wing, Oct 17, 2008 IP
  4. wing

    wing Active Member

    Messages:
    210
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    58
    #4
    wing, Oct 18, 2008 IP