Reputation: 11
Hi All i have the below code within a macro but for some reason it keeps returning the last row as 1 even though it isnt the last row, any thoughts?
lr1 = Sheets("SAPExport").Cells(Rows.Count, "AZ").End(xlUp).Row
Sheets("SAPExport").Range("AZ1:BB" & lr1).AutoFilter Field:=3, Criteria1:=cell.Value
Sheets("SAPExport").Range("AZ1:BB" & lr1).AutoFilter Field:=1, Criteria1:=("Y")
lr = Sheets("SAPExport").Cells(Rows.Count, "AZ").End(xlUp).Row
Upvotes: 0
Views: 487
Reputation: 61
Not sure about the "AZ" range. I guess the goal is to have the latest row of multiple columns ?
If so, try :
lr = Sheets("SAPExport").Columns("A:Z").Find(What:="*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious)
Upvotes: 1