Consulting

Results 1 to 6 of 6

Thread: EXPERT CHALLENGE: HYPERLINK NOT WORKING?

  1. #1

    EXPERT CHALLENGE: HYPERLINK NOT WORKING?

    The attached XLS uses a VBA module "SEARCH" (DoFindAll) that allows you to find a key word in Excel. The search results are returned to a new worksheet named "FindWord". The results are listed with hyperlinks pointing back to the cell(s) the text appears in. The search process works fine except for the hyperlinks. The search results are shown in blue and underlined as if they have been assigned a hyperlink, but when you click on the link an error pops up with "Reference is not valid." Can you suggest what adjustments are needed in order for the hyperlinks to work correctly .

    Thank you very much for your assistance.

    ps

    See attached file SearchWord_Test on reply below.

  2. #2

    Hyperlink Challenge

    Please see attached file.

  3. #3
    MS Excel MVP VBAX Mentor Andy Pope's Avatar
    Joined
    May 2004
    Location
    Essex, England
    Posts
    344
    Location
    The problem is the spaces in your sheet names. You need to enclose the name in single quotes.

    [vba]
    ActiveSheet.Hyperlinks.Add Anchor:=Range("A" & Counter + 2), _
    Address:="", SubAddress:=FindSheet(Counter) & "!" & FindCell(Counter), _
    TextToDisplay:="'" & FindSheet(Counter) & "'!" & FindCell(Counter)
    Range("B" & Counter + 2).Value = FindText(Counter)
    [/vba]
    Cheers
    Andy

  4. #4

    Thumbs up Hyperlinks **** FIXED

    Andy,

    Thank you. Problem solved. The solution wasn't single quotes on the worksheet name under TestToDisplay:=, but under SubAddress:=. However, I suspect you already knew that but wanted me to discover it.

    Brilliant!!!

    Here's the fix...

    ActiveSheet.Hyperlinks.Add Anchor:=Range("A" & Counter + 2), _
    Address:="", SubAddress:="'" & FindSheet(Counter) & "'!" & FindCell(Counter), _
    TextToDisplay:=FindSheet(Counter) & "!" & FindCell(Counter)
    Range("B" & Counter + 2).Value = FindText(Counter)

  5. #5
    MS Excel MVP VBAX Mentor Andy Pope's Avatar
    Joined
    May 2004
    Location
    Essex, England
    Posts
    344
    Location
    sorry about that. But glad you managed to fix my typo.
    Cheers
    Andy

  6. #6

    Wink Hyperlinks

    you da man...

    Thanks again.

Posting Permissions

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