+ Reply to Thread
Results 1 to 6 of 6

Thread: Macro to show all rows

  1. #1
    Registered User
    Join Date
    04-04-2011
    Location
    London
    MS-Off Ver
    Excel 2000
    Posts
    14

    Macro to show all rows

    I'm a novice when it comes to macros I'm afraid. I have a spreadsheet that lists work for several members of my team. When it's completed I don't want to delete it, so have a macro to hide all rows where "Y" is entered into the completed column. So far, highlighting all rows and unhiding has been fine as we have had a very small amount of work, but as time goes on and there's more and more it would be much easier to have another button with a 'show all rows' macro assigned to it. Can anyone help me out here?

    Thanks very much.

  2. #2
    Valued Forum Contributor tlafferty's Avatar
    Join Date
    04-08-2011
    Location
    United States, Tacoma, WA
    MS-Off Ver
    Excel 2010
    Posts
    856

    Re: Macro to show all rows

    How is the data hidden? By autofilter or by setting the row height to 0?

    If it's an autofilter, place the insertion point anywhere in your data, then to toggle the filter on and off:
    Selection.AutoFilter
    If your question has been satisfactorily addressed, please consider marking it solved. Click here to see how.

    Also, you might want to add to the user's reputation by clicking the scales icon - it's why we do what we do...

    Thomas Lafferty
    Analyst/Programmer

  3. #3
    Registered User
    Join Date
    04-04-2011
    Location
    London
    MS-Off Ver
    Excel 2000
    Posts
    14

    Re: Macro to show all rows

    Hi Thomas, thanks for your quick reply. The line from the one I'm using is:

    "For RowCnt = BeginRow To EndRow
    If Cells(RowCnt, ChkCol).Value = "Y" Then
    Cells(RowCnt, ChkCol).EntireRow.Hidden = True
    End If"

  4. #4
    Valued Forum Contributor
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    244

    Re: Macro to show all rows

    Assign to your new button. I assumed sheet1 is called "Sheet1". You may need to edit this.
    Sub Unhide()
    Sheets("Sheet1").UsedRange.EntireRow.Hidden = False
    End Sub

  5. #5
    Registered User
    Join Date
    04-04-2011
    Location
    London
    MS-Off Ver
    Excel 2000
    Posts
    14

    Re: Macro to show all rows

    Sorry if I'm being dense, but do I need to add anything else to that? I'm getting the error:

    "Run-time error "9":

    Subscript out of range"

    What am I doing wrong?

    Thanks,

    Rob

  6. #6
    Registered User
    Join Date
    04-04-2011
    Location
    London
    MS-Off Ver
    Excel 2000
    Posts
    14

    Re: Macro to show all rows

    It's OK, I've got it now after a bit of fiddling. Thank you very much for your help!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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.2.0