+ Reply to Thread
Results 1 to 5 of 5

Unhiding Rows One at A Time Using VBA Macro

Hybrid View

  1. #1
    Registered User
    Join Date
    06-19-2014
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    18

    Unhiding Rows One at A Time Using VBA Macro

    I am currently attempting to build a macro that unhides hidden rows one at a time upon the click of a button.

    I have got as far as using the following code, but this unhides all rows at the same time.
    PHP Code: 
    Sub Sheet4_TextBox1_Click()
     
    Rows("4:33").Select
        Selection
    .EntireRow.Hidden False
    End Sub 
    I want to have about 100 rows to be hidden and to be unhidden one at a time.

    Is this possible?

    Thanks

    Col

  2. #2
    Forum Contributor
    Join Date
    01-04-2013
    Location
    Tampa, Florida
    MS-Off Ver
    Excel 2013
    Posts
    142

    Re: Unhiding Rows One at A Time Using VBA Macro

    Try this:

    Sub UnhideRow()
    
    Dim r As Range
    Dim c As Range
    
    Set r = Range("A:A")
    
    For Each c In r
        If c.EntireRow.Hidden = True Then
            c.EntireRow.Hidden = False
            Exit Sub
        End If
    Next c
    
    MsgBox("There are no hidden rows in this sheet")
    
    End Sub
    Last edited by mo4391; 01-15-2016 at 12:16 PM. Reason: Added message box to notify if no rows are hidden

  3. #3
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Unhiding Rows One at A Time Using VBA Macro

    Try this line of code
    Rows("4:33").EntireRow.Hidden = Not Rows("4:33").EntireRow.Hidden
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  4. #4
    Registered User
    Join Date
    06-19-2014
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    18

    Re: Unhiding Rows One at A Time Using VBA Macro

    Thanks for your help.

  5. #5
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Unhiding Rows One at A Time Using VBA Macro

    You're welcome. Thanks for the feedback and for the rep points

+ 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. [SOLVED] macro for hiding and unhiding rows based on a dropdown selection and cell value
    By cameldew in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-17-2015, 03:52 PM
  2. hiding unhiding rows macro hierarchy
    By dgibney in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 11-19-2014, 01:44 PM
  3. Hiding/Unhiding rows
    By cool53 in forum Excel General
    Replies: 8
    Last Post: 10-25-2013, 02:31 AM
  4. Hiding and unhiding rows
    By Ranjani in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-18-2009, 02:37 AM
  5. [SOLVED] Unhiding Rows
    By Struggling of Essex in forum Excel General
    Replies: 5
    Last Post: 01-02-2006, 10:45 AM
  6. hidden rows keep unhiding themselves!
    By Markathepub in forum Excel General
    Replies: 2
    Last Post: 11-29-2005, 12:39 PM
  7. unhiding rows automatically
    By Mr. G. in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 04-19-2005, 12:06 PM

Tags for this Thread

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