Question Locked

EXCEL - Macros

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have a filtered list in an excel spreadsheet and want the macro to move down one visible cell. the move is from the row where the filter lies to the first visible (filtered) row. b/c the first visable row changes all the time i need to move the active cell down 1 cell, but it must be to the visible cell, no the next cell down in sequence.

looking for ideas. thanks for your help

2 replies

by dr

Hi JT,

Put this in a Standard Module.

Option Explicit

Sub NxVisRow()

'set range variables
Dim cel As Range
Dim rng As Range
Set rng = Range(ActiveCell.Offset(1, 0), ActiveCell.End(xlDown))

'chaek all
For Each cel In rng
'visible?
If cel.EntireRow.Hidden = False Then
'yes = select it and bail
cel.Select
Exit For
End If
'no = check next one
Next cel

'cleanup
Set cel = Nothing
Set rng = Nothing

End Sub

Cheers,

dr

http://www.members.shaw.ca\ExcelVBA

This discussion is closed to new replies.