View Single Post
 
Old 05-14-2019, 07:41 AM
NoSparks NoSparks is offline Windows 7 64bit Office 2010 64bit
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 842
NoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of light
Default

For point 2, after determining arrUniqueCompanies you could try this to determine the latest date and what goes into the 'Daily List'
Code:
' Find latest 'date to be called' by filtering table and using subtotal
With Sheets("Data").ListObjects("tblMain").Range
    For i = LBound(arrUniqueCompanies) To UBound(arrUniqueCompanies)
            company = arrUniqueCompanies(i)
            'remove any existing filters
            .AutoFilter
            'filter for company
            .AutoFilter Field:=4, Criteria1:=company, Operator:=xlFilterValues
            'the latest date
            dateToBeCalled = WorksheetFunction.Subtotal(104, Sheets("Data").ListObjects("tblMain").ListColumns(8).DataBodyRange)
            'Populate the 'Daily Call' list box
            If dateToBeCalled <= Date Then
                DailyList.AddItem arrUniqueCompanies(i)
                DailyList.List(i, 1) = Format(dateToBeCalled, "dd-mmm-yy")
            End If
            'remove filter
            .AutoFilter
    Next i
End With
Reply With Quote