+ Reply to Thread
Results 1 to 2 of 2

Cannot figure out how to write VBA code to loop through list and Hide specific rows

Hybrid View

  1. #1
    Registered User
    Join Date
    06-11-2013
    Location
    Toronto
    MS-Off Ver
    2013
    Posts
    25

    Cannot figure out how to write VBA code to loop through list and Hide specific rows

    Hello, I am struggling with creating vba code to loop through attached list and hide each row where the value corresponding to column "D" value is equal "Posting".
    The attached is a sample dataset which can contain a few to several (hundreds) rows.

    Any help would be greatly appreciated.
    Attached Files Attached Files

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,866

    Re: Cannot figure out how to write VBA code to loop through list and Hide specific rows

    Try:
    Sub HideRows()
        Application.ScreenUpdating = False
        Dim LastRow As Long
        LastRow = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
        ActiveSheet.Range("A1:E" & LastRow).AutoFilter Field:=4, Criteria1:="<>Posting"
        Application.ScreenUpdating = True
    End Sub
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

+ 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] VBA - loop through list of sheets and hide predefined rows in each
    By ISMI in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-17-2018, 08:15 AM
  2. VBA code for Checkbox to hide and unhide rows by a specific name
    By NichlasO in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-19-2017, 12:38 PM
  3. [SOLVED] Need code to hide specific rows based on different cell value
    By majzeln in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-04-2016, 02:02 PM
  4. code to hide specific rows
    By kosherboy in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-23-2016, 11:05 AM
  5. Do I have to write a seperate code for each ActiveX checkbox to hide rows?
    By Angelammarten in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-20-2014, 04:55 PM
  6. [SOLVED] How to write a code within a loop to copy and paste rows on to another Sheet
    By swade730 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-24-2014, 08:40 PM
  7. [SOLVED] Loop specific VBA code for every 15 Rows upto 5000 rows of a sheet
    By Narasimharao Nandula in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-26-2013, 08:48 AM

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