Find first row number after filtering

  • Thread starter Thread starter StevenM
  • Start date Start date
S

StevenM

I set up an autofilter and select the rows that have a blank value in the
column. that's fine. I want to go to the first selected row. When I record
a macro to go to the heading row and then arrow down once, the macro records
the actual row I end up in (A37 in this case). But I need to set a variable
as the next time I run (on a different file) it won't necessarily be A37.
How do I find the row number of the first row after the header row in an
autofiltered spreadsheet?

Appreciate any light you can shed. thanks in advance,
StevenM
 
Post the code ir formula you are using so we have a starting point/
 
Hi Steven,

Try this :

'---------------------------------
Sub First_Row()
On Error Resume Next
With ActiveSheet
If .AutoFilterMode = True Then
With .Range("_FilterDatabase")
MsgBox .Offset(1).Resize(.Rows.Count - 1, _
Columns.Count).SpecialCells(xlCellTypeVisible).Row
End With
End If
End With
End Sub
'---------------------------------


"StevenM" <[email protected]> a écrit dans le message de groupe de
discussion : (e-mail address removed)...
I set up an autofilter and select the rows that have a blank value in the
column. that's fine. I want to go to the first selected row. When I record
a macro to go to the heading row and then arrow down once, the macro records
the actual row I end up in (A37 in this case). But I need to set a variable
as the next time I run (on a different file) it won't necessarily be A37.
How do I find the row number of the first row after the header row in an
autofiltered spreadsheet?

Appreciate any light you can shed. thanks in advance,
StevenM
 
thanks, I see that it returns the row number. Now I would just like to
figure out a) how the heck does it work, and b) saving it to a variable.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top