Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50142

Find the latest entry for a category in a list using VBA

$
0
0
Hello! I hope everyone is having a nice day.
So I have this list with loads of customers. Each day, different updates are being registered in a format I created. In order to create a visual report I want to retrieve the latest update for each customer. Since my format has headers I used filters to select the updates from a date you can determine. The problem is that the macro as a whole gives you the status of the processing of the customer's contract, so by using a filter by dates I can retrieve old information and get alerts for something that is really on time.
My code that searches from a given date is this one.
Code:

Workbooks.Open Filename:="C:\Users\Desktop\Database.xlsx"
    Worksheets("DETALLE").Select
    Range("A1:E1000").Select
    Selection.AutoFilter
    ActiveSheet.Range("$A$1:$F$7").AutoFilter Field:=1, Criteria1:=">=" & fecha, Criteria2:="<=" & fechados
    Range("A2:C1000").Select
    Selection.Copy
    Windows("Resumen2.xlsm").Activate
    Range("B6").Select
    ActiveSheet.Paste
    ActiveSheet.Paste
    Application.CutCopyMode = False

What changes do you thing I should do in order to get only the latest update?
I really appreciate all of your help
Thank you

Viewing all articles
Browse latest Browse all 50142

Trending Articles