ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how to go the the next row when autofilter is activated (https://www.excelbanter.com/excel-programming/323801-how-go-next-row-when-autofilter-activated.html)

François

how to go the the next row when autofilter is activated
 
Hello,
I would like to use something like activeCell.Offset(1,0).Select when
autofilter is activated. How do I code this ?

Many thanks.

Francois

Dave Peterson[_5_]

how to go the the next row when autofilter is activated
 
Maybe just looping through the cells??

Option Explicit
Sub testme()

Dim myCell As Range

Set myCell = ActiveCell
Do
Set myCell = myCell.Offset(1, 0)
If Intersect(myCell, ActiveSheet.AutoFilter.Range) Is Nothing Then
Set myCell = Nothing
Exit Do
End If
If myCell.EntireRow.Hidden = True Then
'keep looking
Else
Exit Do
End If
Loop

If myCell Is Nothing Then
MsgBox "No next cell"
Else
MsgBox myCell.Value & vbLf & myCell.Address
myCell.Select
End If
End Sub


François wrote:

Hello,
I would like to use something like activeCell.Offset(1,0).Select when
autofilter is activated. How do I code this ?

Many thanks.

Francois


--

Dave Peterson


All times are GMT +1. The time now is 11:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com