+ Reply to Thread
Results 1 to 9 of 9

Hidden and visible sheets-swap

  1. #1
    Registered User
    Join Date
    12-21-2007
    Location
    Szeged, HUNGARY
    MS-Off Ver
    2013
    Posts
    43

    Hidden and visible sheets-swap

    Hi all,

    in our classrooms my students work with Excel.
    My goal is to show a single worksheet at the opening of the workbook, with important hints for the user. All the other worksheets must be hidden at this stage.
    After reading the hints the user may proceed,
    (clicking a button) and the result should be:
    1. the hidden worksheets will be visible
    2. except the one which was visible at the opening.

    When the user finishes the work the original
    hidden/visible situation should be restored.

    I wrote a code for the Woksheets collection, and I made a For each; next cycle for all the sheets to do it and it works.

    My question is: is it any other way to do it? I mean a shorter one ore more elegant?

    Thanks in advance:
    KausBorealis

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Would be helpful for others to display your code.

    Note please remember to wrap code as per rule 5 below

    Instead of clicking a button could you use a timer ??

    http://msdn2.microsoft.com/en-us/lib...ffice.11).aspx

    http://www.cpearson.com/excel/OnTime.aspx

    http://www.ozgrid.com/Excel/run-macro-on-time.htm

    When the user finishes the work the original
    How would you know when there finished. Maybe another timer

    Depending on the layout of the sheets maybe when they answer the last question on sheet 1 then it unhides the next sheet and when you answer the last question it rehides all sheets via a event macro

    http://www.cpearson.com/excel/Events.aspx

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Registered User
    Join Date
    12-21-2007
    Location
    Szeged, HUNGARY
    MS-Off Ver
    2013
    Posts
    43

    My code is not in my home (now)

    Hello VBA Noob,

    and thanks.

    I am now at home, while the Excel workbook is in my office computer.

    The OnTime however here can't be used, beause I don't know in advance how long time is neccesary for the actual student to understand the instructions.

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    See if this helps. After they read instuction sheet they change cell D23 (last answer) which takes them to the next sheet

    Code used

    Start Sheet module
    Please Login or Register  to view this content.
    First Sheet module
    Please Login or Register  to view this content.
    Second Sheet module
    Please Login or Register  to view this content.
    Last sheet module
    Please Login or Register  to view this content.
    VBA Noob
    Attached Files Attached Files
    Last edited by VBA Noob; 01-20-2008 at 10:48 AM.

  5. #5
    Registered User
    Join Date
    12-21-2007
    Location
    Szeged, HUNGARY
    MS-Off Ver
    2013
    Posts
    43

    I found your another useful reference

    Hi VBA Noob,

    thanks for your code, nice.


    In the meantime I found your reference (from yesterday)
    http://www.vbaexpress.com/kb/getarticle.php?kb_id=578
    which contains a nice solution.

    I made something similar to it but this solution is much better. Anyway what I wrote doesn't contain anythig additional to this document.


    KausBorealis

  6. #6
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Good to here.

    I've now added the example file (post 4) for my code which I missed off the first time

    VBA Noob

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    This works with the sheet index number, so from left to right with the first sheet being the Intro sheet.

    In a Standard Module
    Please Login or Register  to view this content.
    In each of sheets that precede the final sheet add a Commandbutton with this code

    Please Login or Register  to view this content.
    In the final sheet add a button with this code

    Please Login or Register  to view this content.
    Last edited by royUK; 01-20-2008 at 11:27 AM.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  8. #8
    Registered User
    Join Date
    12-21-2007
    Location
    Szeged, HUNGARY
    MS-Off Ver
    2013
    Posts
    43

    Thanks for royUK

    Hi royUK,

    I tried your code with 3 worksheets, it runs perfectly.
    It is a great help for a teacher.

    KausBorealis

  9. #9
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Quote Originally Posted by KausBorealis
    Hi royUK,

    I tried your code with 3 worksheets, it runs perfectly.
    It is a great help for a teacher.

    KausBorealis
    Glad it helped

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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