+ Reply to Thread
Results 1 to 10 of 10

Follow Hyperlinks wih Workbook structure protected

  1. #1
    Registered User
    Join Date
    11-17-2020
    Location
    UK
    MS-Off Ver
    2016
    Posts
    21

    Follow Hyperlinks wih Workbook structure protected

    Hello!

    I am trying to develop a workbook, with an index and several tabs. Some tabs should never been shown (the tabs "Stores" and "Cities").

    I would like to show only some tabs (the ones with the hyperlink in the index) and they should only be shown once one's clicks on the hyperlink (and once i click in "Back Home", they should be hidden again). I was using the vba code in the excel attached and everything was working perfectly.

    The problem is that when I protect the workbook structure (password=123), the hyperlinks stop to work.

    Any suggestions of how can I change the code, so I can overcome this difficulty?

    Thank you.
    Attached Files Attached Files
    Last edited by AliGW; 01-20-2022 at 10:46 AM.

  2. #2
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,220

    Re: Follow Hyperlinks wih Workbook structure protected

    This can be done using "fake" links. Details in the attachment.

    Artik
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    11-17-2020
    Location
    UK
    MS-Off Ver
    2016
    Posts
    21

    Re: Follow Hyperlinks wih Workbook structure protected

    Thank you very much @Artik!

    One question: what does this code: Set rng = Range(Target.Range.Offset(, -1).Hyperlinks(1).SubAddress)? What does that -1 and that 1 mean? Thank you a lot.

  4. #4
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,220

    Re: Follow Hyperlinks wih Workbook structure protected

    Target is the hyperlink that has been clicked on.
    Target.Range is the cell reference of this hyperlink.
    Target.Range.Offset (, -1) is the reference of the cell shifted one column to the left.
    Target.Range.Offset (, -1).Hyperlinks(1).SubAddress - this computed cell contains a real link, we get the address from it. The return address is like: Sheet3!A1

    BTW.
    Replace this line
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    Artik

  5. #5
    Registered User
    Join Date
    11-17-2020
    Location
    UK
    MS-Off Ver
    2016
    Posts
    21

    Re: Follow Hyperlinks wih Workbook structure protected

    Thank you! One last question: How do you manage to when you pass with the cursor in cell B2 of tab index, it appears "Go to Sheet2" and in cell B3 "Go to Sheet3"?
    Thanks

  6. #6
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,220

    Re: Follow Hyperlinks wih Workbook structure protected

    Edit hyperlink and...

    Artik
    Attached Images Attached Images

  7. #7
    Registered User
    Join Date
    11-17-2020
    Location
    UK
    MS-Off Ver
    2016
    Posts
    21

    Re: Follow Hyperlinks wih Workbook structure protected

    Got it! Thank you. Just a last doubt, so I can close the thread.

    I've added another sheet (sheet "justforsheet2") whose fake link and Hyperlink can be found on tab "Sheet2". But it's not working. Any ideas why?

    Thanks Art and sorry for so many questions, I'm a newbie in coding
    Attached Files Attached Files
    Last edited by AliGW; 01-20-2022 at 10:48 AM.

  8. #8
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,220

    Re: Follow Hyperlinks wih Workbook structure protected

    This is because cells are merged.
    In Workbook_SheetFollowHyperlink replace line:
    Please Login or Register  to view this content.
    Artik

  9. #9
    Registered User
    Join Date
    11-17-2020
    Location
    UK
    MS-Off Ver
    2016
    Posts
    21

    Re: Follow Hyperlinks wih Workbook structure protected

    That makes sense! It worked. Thank you for all your help!

  10. #10
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,220

    Re: Follow Hyperlinks wih Workbook structure protected

    Something made me dizzy in those days. There is no need to create a column with fake links.
    And the code in the ThisWorrkbook module should be changed to:
    Please Login or Register  to view this content.
    Plus Workbook_SheetDeactivate unchanged.

    Sorry.

    Artik

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Follow Selected Hyperlinks - VIsible Cells only.
    By NewYears1978 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-25-2019, 11:15 AM
  2. [SOLVED] Macro to follow hyperlinks when a certain criteria is met
    By Swarnendu in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-22-2017, 09:11 PM
  3. Hyperlinks.Follow not working
    By rodgersmg in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-04-2015, 03:52 AM
  4. [SOLVED] Macro to follow dynamic hyperlinks
    By samcdavies in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-28-2013, 11:50 AM
  5. Sheet Management - Protected Workbook Structure
    By neodjandre in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-26-2007, 07:38 AM
  6. Need to follow hyperlinks in selection
    By gregorydarmohra in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-22-2007, 09:37 PM
  7. How to NOT follow hyperlinks when clicked?
    By Zimpaz in forum Excel General
    Replies: 0
    Last Post: 07-05-2007, 04:51 AM

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