+ Reply to Thread
Results 1 to 16 of 16

VBA: Search text and extract hyperlink in same cell

  1. #1
    Forum Contributor
    Join Date
    05-01-2013
    Location
    IND
    MS-Off Ver
    Excel 2007
    Posts
    130

    VBA: Search text and extract hyperlink in same cell

    Search text "Value link" any where in each sheet except x,y and z.
    And then extract hyperlink website address in same cell


    Sub addtext1()
    Dim ws As Worksheet For Each ws In Worksheets If ws.Name <> "x" And ws.Name <> "y" And ws.Name <> "z" Then

    Your CODE

    End If End If Next ws End Sub

  2. #2
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: VBA: Search text and extract hyperlink in same cell

    What do you want done with the extracted hyperlink address?
    Gary's Student

  3. #3
    Forum Contributor
    Join Date
    05-01-2013
    Location
    IND
    MS-Off Ver
    Excel 2007
    Posts
    130

    Re: VBA: Search text and extract hyperlink in same cell

    Data formatting in excel sheet.

  4. #4
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: VBA: Search text and extract hyperlink in same cell

    Very good!

    Now if we find a hyperlink in cell B9 and extract its address, shall we put that address back in B9 or in C9 or in B10?

  5. #5
    Forum Contributor
    Join Date
    05-01-2013
    Location
    IND
    MS-Off Ver
    Excel 2007
    Posts
    130

    Re: VBA: Search text and extract hyperlink in same cell

    If we find a hyperlink in cell B9 then extract its address in B9.

  6. #6
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: VBA: Search text and extract hyperlink in same cell

    Try this:

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    05-01-2013
    Location
    IND
    MS-Off Ver
    Excel 2007
    Posts
    130

    Re: VBA: Search text and extract hyperlink in same cell

    I have to put the word "Value link" in the code so that it can find it and extract the text despite anywhere it occurs in the used range of each sheet except x,y and z. See my first post.

  8. #8
    Forum Contributor
    Join Date
    05-01-2013
    Location
    IND
    MS-Off Ver
    Excel 2007
    Posts
    130

    Re: VBA: Search text and extract hyperlink in same cell

    If we find a hyperlink in cell B9 then extract its address in B9 - apologies for the misunderstanding. If "Value link" appears in B9 then extract its address in B9.

  9. #9
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: VBA: Search text and extract hyperlink in same cell

    I have added a test for "Value link"

    Please Login or Register  to view this content.

  10. #10
    Forum Contributor
    Join Date
    05-01-2013
    Location
    IND
    MS-Off Ver
    Excel 2007
    Posts
    130

    Re: VBA: Search text and extract hyperlink in same cell

    Worked beautifully. Thanks.
    And what if I want to extract all hyperlinks in column C.

  11. #11
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: VBA: Search text and extract hyperlink in same cell

    Do you want all the hyperlinks is column C extracted or only the "Value link" ones??

  12. #12
    Forum Contributor
    Join Date
    05-01-2013
    Location
    IND
    MS-Off Ver
    Excel 2007
    Posts
    130

    Re: VBA: Search text and extract hyperlink in same cell

    Yes all the hyperlinks is column C.

  13. #13
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: VBA: Search text and extract hyperlink in same cell

    UNTESTED:

    Please Login or Register  to view this content.

  14. #14
    Forum Contributor
    Join Date
    05-01-2013
    Location
    IND
    MS-Off Ver
    Excel 2007
    Posts
    130

    Re: VBA: Search text and extract hyperlink in same cell

    Worked. Thank you.

  15. #15
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: VBA: Search text and extract hyperlink in same cell

    You are very welcome!

  16. #16
    Forum Contributor
    Join Date
    05-01-2013
    Location
    IND
    MS-Off Ver
    Excel 2007
    Posts
    130

    Re: VBA: Search text and extract hyperlink in same cell

    Finally I want to clear all other hyper linked texts or sentences if existed in used range of each sheet except x,y and z.
    PS:This is not weblink extracting. Just a code which turns text or sentences into not hyperlinked. Hope I am clear.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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