+ Reply to Thread
Results 1 to 6 of 6

Hide blank rows button macro

  1. #1
    Registered User
    Join Date
    10-31-2010
    Location
    Tampa, FL
    MS-Off Ver
    Excel 2007
    Posts
    95

    Hide blank rows button macro

    I am trying to figure out how to make a button macro that will scan column A and if the value is blank or has the word "qnt." in it, then it will hide that entire row and also another button macro to unhide those same rows if I need to expand everything again.

  2. #2
    Valued Forum Contributor
    Join Date
    06-17-2009
    Location
    Chennai,India
    MS-Off Ver
    Excel 2003,excel 2007
    Posts
    678

    Re: Hide blank rows button macro

    assign these two macros for the two buttons

    Please Login or Register  to view this content.

    Please Login or Register  to view this content.
    Last edited by venkat1926; 11-24-2010 at 08:52 AM.

  3. #3
    Registered User
    Join Date
    10-31-2010
    Location
    Tampa, FL
    MS-Off Ver
    Excel 2007
    Posts
    95

    Re: Hide blank rows button macro

    Works great, thank you. The unhide formula had the wrong column, but I fixed it and it works great, thank you.

  4. #4
    Registered User
    Join Date
    04-29-2016
    Location
    London
    MS-Off Ver
    2013
    Posts
    2

    Re: Hide blank rows button macro

    Appreciate this is an old thread, but its NEARLY what I'm after and I am a total novice at this stuff - so didn't feel a total new thread would be useful.

    Sub hide_rows()
    Dim r As Range
    Dim r1 As Range
    Set r = Range("A1").CurrentRegion
    r.AutoFilter Field:=1, Criteria1:="=", Operator:=xlOr, Criteria2:="qnt"
    Set r1 = r.Cells.SpecialCells(xlCellTypeVisible)
    Set r1 = r.Offset(1, 0).Resize(Rows.Count - 1, Columns.Count).Cells.SpecialCells(xlCellTypeVisible)
    ActiveSheet.AutoFilterMode = False
    r1.Rows.Hidden = True
    End Sub

    The above code nearly works in that I want it to delete empty rows on a different sheet (named 'Quote') to the button is, but I can't seem to work out where to enter this information.

    Help much appreciated!

    J

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,050

    Re: Hide blank rows button macro

    cheggers33 welcome to the forum

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.

    (also, please take a look at the rules regarding using code tags when posting VBA code )
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  6. #6
    Registered User
    Join Date
    04-29-2016
    Location
    London
    MS-Off Ver
    2013
    Posts
    2
    Quote Originally Posted by FDibbins View Post
    cheggers33 welcome to the forum

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.

    (also, please take a look at the rules regarding using code tags when posting VBA code )
    Apologies! Will repost. Thanks

+ 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