+ Reply to Thread
Results 1 to 5 of 5

Macro to hide rows.

Hybrid View

redasin Macro to hide rows. 05-23-2012, 01:53 PM
arlu1201 Re: Macro to hide rows. 05-23-2012, 01:57 PM
tigeravatar Re: Macro to hide rows. 05-23-2012, 01:58 PM
Richard Buttrey Re: Macro to hide rows. 05-23-2012, 01:58 PM
dilipandey Re: Macro to hide rows. 05-23-2012, 02:12 PM
  1. #1
    Registered User
    Join Date
    05-23-2012
    Location
    baton rouge, la.
    MS-Off Ver
    Excel 2003
    Posts
    1

    Unhappy Macro to hide rows.

    I have a workbook with about 300 worksheets in it. I want to hide row 5 in all worksheets at once.

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro to hide rows.

    Is it always row5 that you want hidden?
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Macro to hide rows.

    redasin,

    Welcome to the forum!
    Give this a try:
    Sub tgr()
        
        Dim ws As Worksheet
        For Each ws In ActiveWorkbook.Sheets
            ws.Rows(5).Hidden = True
        Next ws
        
    End Sub
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Macro to hide rows.

    Hi

    Sub HideRowFive()
        Dim ws As Worksheet
        For Each ws In ActiveWorkbook.Sheets
            ws.Rows(5).Hidden = True
        Next ws
    End Sub
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  5. #5
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Macro to hide rows.

    Hi redasin,

    Welcome to the forum.
    Below is a quick code which can be used:-

    Sub hide()
    
        For Each Sheet In ActiveWorkbook.Sheets
    
        Rows(5).Hidden = True
    
        On Error Resume Next
        ActiveSheet.Next.Select
        Next
    
    End Sub
    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    Last edited by arlu1201; 05-23-2012 at 02:13 PM. Reason: Thread already moved.
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), dilipandey@gmail.com

+ 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