+ Reply to Thread
Results 1 to 9 of 9

difficult filter/sort

Hybrid View

  1. #1
    Registered User
    Join Date
    10-31-2010
    Location
    clydebank, scotland
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: difficult filter/sort

    I have attached a file showing several fields with the headings starting at row1 column 1.
    I would like to filter out the rows of data where the IDNumber has no blanks below them.

    This is because I want to show rows wher there is an IDNumber and the blanks below because they are the IDs of people who have worked for different departments.

    The original spreadsheets may have a copule of thousand rows in them.

    Thanks very much for your help in this

    I have attached an excel spreadsheet this time
    Attached Files Attached Files

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

    Re: difficult filter/sort

    Tomas mcD,

    Based on the excel sample workbook you provided, I updated the macro to the following:
    Sub FilterMacro_for_Tomas_mcD()
        
        Dim rngID As Range: Set rngID = Range("A2", Cells(Rows.Count, "A").End(xlUp))
        
        Dim IDCell As Range, RowsToHide As Range
        For Each IDCell In rngID
            If IDCell.Value = vbNullString _
            Or IDCell.Offset(1, 0).Value = vbNullString _
            And IDCell.Offset(1, 2).Value <> vbNullString Then
            Else
                If RowsToHide Is Nothing Then
                    Set RowsToHide = IDCell
                Else
                    Set RowsToHide = Union(RowsToHide, IDCell)
                End If
            End If
        Next IDCell
        
        RowsToHide.EntireRow.Hidden = True
        
    End Sub


    Hope that helps,
    ~tigeravatar

+ 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