+ Reply to Thread
Results 1 to 2 of 2

Hide rows conditionally

  1. #1
    Registered User
    Join Date
    02-02-2005
    Posts
    3

    Hide rows conditionally

    I have an xls file with 11 sheets. On the first sheet, I have a data validation list (drop-down) from which you can choose 5 options. When option 1 is selected, this should hide rows 1-10 of all the other sheets. When option 2 is selected, this should hide rows 1-20 of all the other sheets. When option 3 is chosen, this should hide rows 1-30 of all the other sheets and so on.

    Can anyone please help me with this? I would appreciate it!!

    Thanks,
    PGPH

  2. #2
    Registered User
    Join Date
    02-21-2005
    Posts
    8
    this is a nice little trick, i've used it in projects before.

    there are 2 simple ways to do it. 1) put 20 hide statements, or 2) use a for loop (much much more efficient)

    the for loop would look something like:

    For Counter = 1 to 20
    Worksheets("Sheet1").Rows(Counter).Hidden = True
    Next Counter

    then you can go farther and replace the 20 with a variable and fill the variable with the value in the drop down list.

    also, dont forget to un-hide the rows from the last time you ran the macro, as you might have hidden 30 rows the first time and if you hide 20 the second time the other 10 are still hidden.

+ 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