Move cursor down, skipping hidden rows

  • Thread starter Thread starter danwPlanet
  • Start date Start date
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.
 
Try this

Dim rng As Range
Set rng = Range(Cells(ActiveCell.Row + 1, 1), Cells(Rows.Count, 1))
rng.SpecialCells(xlCellTypeVisible).Cells(1).Select
 
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.
 
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.
Back
Top