+ Reply to Thread
Results 1 to 9 of 9

difficult filter/sort

Hybrid View

  1. #1
    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,

    Attached is a sample file based on the sample data you provided. It contains a button named "Filter" which is assigned to the following macro:
    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
    Attached Files Attached Files
    Last edited by tigeravatar; 06-30-2011 at 03:55 PM.

+ 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