Detecting Row number

  • Thread starter Thread starter jose luis
  • Start date Start date
J

jose luis

Hello

I want to detect the number of the row that shows the last data after
after filtering a table. Let me explain, I have a table with autofilter
on, and after filtering one column using any criterion, i want to know
the Row number of the last data remaining. I hope it's clear enough to
you in order to suggest me some ideas.

Thanks in advance

Regards

Jose Luis
 
Off the top of my head there are 2 ways.
1. if there is nothing beneath your autofiltered data
LastVisibleRow = Range("A" & Rows.Count).End(xlUp).Row

2. If there is something beneath autofilter and Column "A" or any other
Column that you specify has data in every row, down to the last row.
LastVisibleRow = Range("A1").End(xlDown).Row

HTH

Die_Another_Day
 
A little longer, but seemed to work. Worksheet reference would have to be
changed.

Sub test()
With Worksheets("Sheet2")
With Intersect(.AutoFilter.Range, _
.Cells.SpecialCells(xlCellTypeVisible))
With .Areas(.Areas.Count)
MsgBox .Rows(.Rows.Count).Row
End With
End With
End With
End Sub
 
Back
Top