Code to find the last used row in filtered data.
Sub find()
Dim rFiltered As Range
With ActiveSheet.AutoFilter.Range
Set rFiltered = .Resize(.Rows.Count - 1).Offset(1).Columns(2).SpecialCells(xlCellTypeVisible)
End With
'is shows 419 - and that is fine
FirstRow = rFiltered.Cells(1, 1).End(xlToLeft).Row
'it shows the very last row 1048576, not the last row in a filtered range
'it should be 423
LastRow = rFiltered.Cells(FirstRow).End(xlDown).Row
For r = FirstRow To LastRow
If Sheet1.Cells(r, 2).Value = "Maria L" Then
Rows(r).Interior.Color = rgbBlue
End If
Next r
End Sub
Sample data that is filtered
R Number Name
4879668 Maria L
4879668 Thomas Y
4879668 Eleanor B
4879668 Eleanor B
4879668 Sandra J
The first used row here is 419, the last one is 423, but it shows the very last row 1048576.
The code shows correct LastRow only when filtered data begins from second row.