ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Move cursor down, skipping hidden rows (https://www.excelbanter.com/excel-programming/318779-move-cursor-down-skipping-hidden-rows.html)

[email protected]

Move cursor down, skipping hidden rows
 
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.


Ron de Bruin

Move cursor down, skipping hidden rows
 
Try this

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


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


wrote in message ups.com...
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.




Ron de Bruin

Move cursor down, skipping hidden rows
 
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).Selec t


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


"Ron de Bruin" wrote in message ...
Try this

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


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


wrote in message ups.com...
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.






[email protected]

Move cursor down, skipping hidden rows
 
Wow! Nice, thanks!
Dan



All times are GMT +1. The time now is 02:29 AM.

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