Move cursor down, skipping hidden rows

Status
Not open for further replies.
D

danwPlanet

How can I program the cursor to do what happens when I press the Down
Arrow key, with regard to ignoring hidden rows?

If I use

[VBA] ActiveCell.Offset(1, 0).Select

....the cursor moves down to the next numerical row, which may be a
hidden row.

If I use

[VBA] SendKeys "{DOWN}"

....it behaves like CTRL+SHIFT+Down Arrow, selecting all the contiguous
non-blank cells below the active cell. That's not as advertised,
right?? (I have to remember not to execute this statement while in the
VBA editor, because from there it just moves the VBA editor's cursor.)
This is in Excel 2000.
 
R

Ron de Bruin

Try this

Dim rng As Range
Set rng = Range(Cells(ActiveCell.Row + 1, 1), Cells(Rows.Count, 1))
rng.SpecialCells(xlCellTypeVisible).Cells(1).Select
 
R

Ron de Bruin

Oops
My example will only work in Col A

Dim rng As Range
Set rng = Range(Cells(ActiveCell.Row + 1, ActiveCell.Column), Cells(Rows.Count, ActiveCell.Column))
rng.SpecialCells(xlCellTypeVisible).Cells(1).Select


--
Regards Ron de Bruin
http://www.rondebruin.nl


Ron de Bruin said:
Try this

Dim rng As Range
Set rng = Range(Cells(ActiveCell.Row + 1, 1), Cells(Rows.Count, 1))
rng.SpecialCells(xlCellTypeVisible).Cells(1).Select


--
Regards Ron de Bruin
http://www.rondebruin.nl


How can I program the cursor to do what happens when I press the Down
Arrow key, with regard to ignoring hidden rows?

If I use

[VBA] ActiveCell.Offset(1, 0).Select

...the cursor moves down to the next numerical row, which may be a
hidden row.

If I use

[VBA] SendKeys "{DOWN}"

...it behaves like CTRL+SHIFT+Down Arrow, selecting all the contiguous
non-blank cells below the active cell. That's not as advertised,
right?? (I have to remember not to execute this statement while in the
VBA editor, because from there it just moves the VBA editor's cursor.)
This is in Excel 2000.
 
Joined
Feb 1, 2019
Messages
1
Reaction score
0
Hi guys,
Awesome code you had here thousand years ago :).
It's working perfectly.
Dim rng As Range
Set rng = Range(Cells(ActiveCell.Row + 1, ActiveCell.Column), Cells(Rows.Count, ActiveCell.Column))
rng.SpecialCells(xlCellTypeVisible).Cells(1).Select

But now I'm looking for this code to do the same but reverse. Instead of going down how to make it go up??
Thank you in advance for your precious help.

Cheers.
 
Status
Not open for further replies.

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

Top