+ Reply to Thread
Results 1 to 4 of 4

Hide and unhide a range of rows in multiple worksheets

Hybrid View

  1. #1
    Registered User
    Join Date
    10-29-2013
    Location
    Maryland
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2305 Build 16.0.16501.20074) 64-bit
    Posts
    54

    Hide and unhide a range of rows in multiple worksheets

    Hello,

    I have a price model with 9 worksheets. 5 of the 9 worksheets are data input worksheets. The 5 worksheets are for the Base Year, Option Yr 1, Option Yr 2 etc. I am trying to hide rows for the smaller version to capture fewer personnel and unhide rows for a larger version. In other words I am trying to make this workbook scalable. I have tried a macro to either hide or unhide 20 of the same rows on each of the worksheets at the same time but it doesn't work.

    Any idea would be greatly appreciated.

    Mark

  2. #2
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,088

    Re: Hide and unhide a range of rows in multiple worksheets

    Can you prepare a short sample file showing how the data is spread and what is the final expected result
    Last edited by PCI; 03-28-2015 at 06:01 PM.
    - Battle without fear gives no glory - Just try

  3. #3
    Registered User
    Join Date
    10-29-2013
    Location
    Maryland
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2305 Build 16.0.16501.20074) 64-bit
    Posts
    54

    Re: Hide and unhide a range of rows in multiple worksheets

    Hi,

    There really is no need to provide an example. I simply just want to be able to hide a set of rows in either a macro and unhide via macro. Lets say that I want to hide rows 24-32 and rows 48-58 and rows 72-80. Is there a way to do this to all five worksheets at once. The data is laid out exactly the same on each worksheet. Thanks for trying to help. Your inputs would be apprecitated.

  4. #4
    Forum Expert
    Join Date
    02-22-2013
    Location
    London, UK
    MS-Off Ver
    Office 365
    Posts
    1,218

    Re: Hide and unhide a range of rows in multiple worksheets

    One example:
    Sub test()
        Dim ws As Worksheet
        For Each ws In ThisWorkbook.Sheets(Array("Sheet2", "Sheet3", "etc"))        'change sheet names
            With ws.Rows("24:32")        'subprocedure to hide the rows you want, toggle in this example
                .Hidden = Not .Hidden        'or, True for hide, False for unhide
            End With
        Next ws
    End Sub
    Where you change to the correct sheet names and the code will only loop through those sheets. Then add a subprocedure for hiding/unhiding rows. Another alternative is to loop through all worksheets and only do a subprocedure on those with the specific worksheet names or that match the structure on the sheet you are looking for, etc.

    Hope this helps a bit,

    berlan

+ 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. Hide-Unhide rows on multiple worksheets based on value of a drop down list
    By clo2peter in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-10-2014, 08:32 AM
  2. [SOLVED] First unhide all rows - then hide rows based on specific cell value for a range of cells
    By robbiekh in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-22-2013, 05:46 PM
  3. Hide or Unhide Multiple Worksheets in a selected workbook
    By nchavan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-22-2013, 10:11 AM
  4. Using multiple checkboxes as an index page to hide/unhide worksheets
    By Damien_Lee in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-11-2013, 07:24 AM
  5. Hide/Unhide a range of rows when cell is empty
    By chuck edwards in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-10-2012, 04:25 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