+ Reply to Thread
Results 1 to 5 of 5

I need to adust the macro to run over multiple sheets - it finds and replaces hyperlinks

  1. #1
    Registered User
    Join Date
    11-15-2012
    Location
    australia
    MS-Off Ver
    Excel 2012
    Posts
    33

    I need to adust the macro to run over multiple sheets - it finds and replaces hyperlinks

    I have a cool macro that finds and replaces hyperlinks especially useful when hit by the C:\@GMT- bug


    But I have been effected by the bug hitting all the sheets so instead of having to select each sheet and running this useful macro can someone post the changes to get it to work over all the sheets in the book ?

    Sub FindReplaceHLinks(sFind As String, sReplace As String, _
    Optional lStart As Long = 1, Optional lCount As Long = -1)

    Dim rCell As Range
    Dim hl As Hyperlink

    For Each rCell In ActiveSheet.UsedRange.Cells
    If rCell.Hyperlinks.Count > 0 Then
    For Each hl In rCell.Hyperlinks
    hl.Address = Replace(hl.Address, sFind, sReplace, lStart, lCount, vbTextCompare)
    Next hl
    End If
    Next rCell
    End Sub

    Sub Doit()

    FindReplaceHLinks "find what to replace here", "replace it with here"

    End Sub

  2. #2
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,525

    Re: I need to adust the macro to run over multiple sheets - it finds and replaces hyperlin

    Hi excel_joel,

    Try this:

    Please Login or Register  to view this content.
    HTH

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  3. #3
    Registered User
    Join Date
    11-15-2012
    Location
    australia
    MS-Off Ver
    Excel 2012
    Posts
    33

    Re: I need to adust the macro to run over multiple sheets - it finds and replaces hyperlin

    Hey Robert thanks for the swift reply,


    this is very simular to what I've been trying , hmmm. Doesnt seem to work

  4. #4
    Registered User
    Join Date
    11-15-2012
    Location
    australia
    MS-Off Ver
    Excel 2012
    Posts
    33

    Re: I need to adust the macro to run over multiple sheets - it finds and replaces hyperlin

    I just ended up doing a record macro, and selecting the sheets and running the macro.

  5. #5
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,525

    Re: I need to adust the macro to run over multiple sheets - it finds and replaces hyperlin

    Try this then:

    Please Login or Register  to view this content.
    HTH

    Robert

+ 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