+ Reply to Thread
Results 1 to 24 of 24

How to create navigation with VBA

  1. #1
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Sweden
    MS-Off Ver
    2016.
    Posts
    397

    How to create navigation with VBA

    I am trying to create a simple navigation in 20 worksheets with different names, just like in this forum:

    Please Login or Register  to view this content.
    But I want mine to say:

    Please Login or Register  to view this content.
    And I want to be able to click the links to get to the start page and to reload the current active worksheet.

  2. #2
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Sweden
    MS-Off Ver
    2016.
    Posts
    397

    Re: How to create navigation with VBA

    Any suggestions on how I can accomplish this?

  3. #3
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: How to create navigation with VBA

    Can you upload sample of your workbook with the expected output?
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  4. #4
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: How to create navigation with VBA

    This type of thing navigation menu??
    Attached Images Attached Images
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Sweden
    MS-Off Ver
    2016.
    Posts
    397

    Re: How to create navigation with VBA

    I am still trying to achieve this effect. Any suggestions?

    I want cell B2 to say:

    Please Login or Register  to view this content.
    or

    Please Login or Register  to view this content.


    Where Hyperlink is a hyperlink that you can click and go to the home page, reports in a hyperlink that you can click and go to the reports page etc.

  6. #6
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Sweden
    MS-Off Ver
    2016.
    Posts
    397

    Re: How to create navigation with VBA

    Anyone?

    Please Login or Register  to view this content.
    I want Home, Reports and May to be clickable as an URL!

  7. #7
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Sweden
    MS-Off Ver
    2016.
    Posts
    397

    Re: How to create navigation with VBA

    I have tried using hyperlink without results!

    Can anyone give me some suggestions on how I can accomplish this?

  8. #8
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: How to create navigation with VBA

    It sounds like you are trying to create a situation where clicking on different parts of a string will bring you to different places in a workbook.

    Where is the string that you would click on?

    In your example "start / active worksheet name", what is "start"? a workbook?
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  9. #9
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Sweden
    MS-Off Ver
    2016.
    Posts
    397

    Re: How to create navigation with VBA

    Hi, thank you for your reply!!

    I am trying with any string. I want to be able to click "Home", "Reports" and "May". When I click "Home" I get to my startpage, when I click "Reports" I get to my reportpage etc.

    ="Home" & " > " & " Reports" & " > " & "May"

    At the moment I am doing this manually but I would like to use activesheet for it to be automatic.

  10. #10
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: How to create navigation with VBA

    So the string is not a structure of different levels (like the navigation on this website) but a history of your "travels".

    Where do you want this string?

  11. #11
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Sweden
    MS-Off Ver
    2016.
    Posts
    397

    Re: How to create navigation with VBA

    Thank you for your reply!

    I would like it to be like a structure of the different levels (just like the navigation on this webpage).

    Anywhere, say cell E6.

    But I am curious of the latter example, like a history of my travels.

    Could you teach me how to do both?

  12. #12
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: How to create navigation with VBA

    For Excel, there are three levels, Workbook, Worksheet and Range

    A level based string would look like Book1 > Home > $A$1
    And when the user went to the report sheet the string would look like Book1 > Report > $A$1

    In post #9, the string Home > Report > May is a history of what sheets you traveled to (all on the same level)

  13. #13
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Sweden
    MS-Off Ver
    2016.
    Posts
    397

    Re: How to create navigation with VBA

    Thank you for your reply, you are correct and I didn't think about the three levels in Excel!

    I want the string Home > Report > May.

  14. #14
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: How to create navigation with VBA

    The attached sheet has a user-defined heirachy

    Home
    -Report
    --Jan
    --Feb
    --Mar
    -Sales
    --January
    --February
    ---ValentinesSales
    --March

    The sub SetHeirarchy allows you to specify which sheet is the immediate superior. It should be run everytime you make a new worksheet. Note that the top level sheet (Home) has no superior.

    Navigating between the sheets will create a (temporary) floating command bar that you can click on to navigate to the indicated sheet.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    I hope this helps.
    Attached Files Attached Files

  15. #15
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Sweden
    MS-Off Ver
    2016.
    Posts
    397

    Re: How to create navigation with VBA

    Hi, thank you for your reply! I have tried your attached workbook and copy & paste to a new document and I don't see any floating command bars :/

    SetHeirarchy works and I have tried running it from a shape also. Where is the floating bar supposed to be?
    Last edited by waimea; 12-02-2018 at 03:32 PM.

  16. #16
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: How to create navigation with VBA

    If you open my workbook and switch between sheets, does the command bar appear?

  17. #17
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Sweden
    MS-Off Ver
    2016.
    Posts
    397

    Re: How to create navigation with VBA

    Hi, no. The SetHeirarchy marco runs but I don't see any command bars! I am using Excel 2016.

  18. #18
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: How to create navigation with VBA

    Try changing this part of the code (in Module 1).
    Then save the file, QUIT excel (don't just close the workbook) and the open the workbook again.
    Please Login or Register  to view this content.

  19. #19
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Sweden
    MS-Off Ver
    2016.
    Posts
    397

    Re: How to create navigation with VBA

    I have tried your suggestion but I still don't see any commandbars!

    Does it work for you in your attached workbook?

  20. #20
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: How to create navigation with VBA

    Yes, it works for me (Excel 2011)

  21. #21
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Sweden
    MS-Off Ver
    2016.
    Posts
    397

    Re: How to create navigation with VBA

    Ok, I don't have access to Excel 2011!

    Could you help me with an easier way to get my desired string?

    I have tried hyperlink but I don't understand how to create X number of links in one string.

    Please Login or Register  to view this content.

  22. #22
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: How to create navigation with VBA

    Getting the string is one thing, but it has to be put in a place where clicking on it (or a portion of it) will take you to the desired sheet.

  23. #23
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Sweden
    MS-Off Ver
    2016.
    Posts
    397

    Re: How to create navigation with VBA

    Hi, thank you for your replies!

    Could you show me how to create a string with 3 different links in it?

  24. #24
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Sweden
    MS-Off Ver
    2016.
    Posts
    397

    Re: How to create navigation with VBA

    Hi mikerickson,

    could you show me how to create the navigation?

+ 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. Replies: 5
    Last Post: 05-20-2018, 10:34 PM
  2. [SOLVED] Navigation
    By steven_b46 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-31-2014, 01:03 PM
  3. Vba to ie navigation
    By moinsk21 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-30-2014, 06:53 AM
  4. [SOLVED] Tab-to-Tab Navigation
    By ikslohap in forum Excel General
    Replies: 2
    Last Post: 08-20-2011, 03:26 PM
  5. Routine to create navigation buttons
    By allanr in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-21-2008, 04:30 AM
  6. How to create navigation buttons
    By freddo85 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-23-2007, 03:48 AM
  7. [SOLVED] Navigation help please
    By Walt Campbell in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 05-30-2005, 04:05 PM

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