+ Reply to Thread
Results 1 to 3 of 3

VB code for showing/hiding the following 20 rows?

  1. #1
    Registered User
    Join Date
    03-30-2012
    Location
    Tamworth, EN
    MS-Off Ver
    Excel 2007?
    Posts
    14

    VB code for showing/hiding the following 20 rows?

    I have buttons that show and hide specific sets of rows:

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    I have 60 locations to do this for!

    Is there any way I can just tell excel to hide/show the next 20 rows rather than having to record each macro individually?
    Last edited by arlu1201; 03-30-2012 at 10:04 AM. Reason: Code tags not quote tags

  2. #2
    Forum Contributor mccrimmon's Avatar
    Join Date
    02-19-2004
    Location
    Scotland
    MS-Off Ver
    2003
    Posts
    249

    Re: VB code for showing/hiding the following 20 rows?

    You do not need to select the rows.

    This code will do the exact same thing and run quicker.

    Please Login or Register  to view this content.
    The above example is if you need to hardcode the row numbers.

    If you want it to do the first 20 hidden then the next 20 shown followed by the next 20 hidden then you would need to put these in a loop
    McCrimmon

  3. #3
    Registered User
    Join Date
    03-30-2012
    Location
    Tamworth, EN
    MS-Off Ver
    Excel 2007?
    Posts
    14

    Re: VB code for showing/hiding the following 20 rows?

    I have little no code experience so I am literally recording these macros individually.

    Is it going to be possible for me to have one macro (one piece of code) that I can use on every button.

    For reference, rows 1, 2, 23, 44, 65, 86, 107 etc etc are the rows that I want shown. I want a button next to each of these rows that shows (and similarly hides, can be in a separate button) the next 20 rows.

    edit: p.s. thank you!!!

+ 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