Move cursor down, skipping hidden rows

Discussion in 'Microsoft Excel Programming' started by danwPlanet, Dec 11, 2004.

Thread Status:
Not open for further replies.
  1. danwPlanet

    danwPlanet Guest

    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.
     
    danwPlanet, Dec 11, 2004
    #1
    1. Advertisements

  2. danwPlanet

    Ron de Bruin Guest

    Try this

    Dim rng As Range
    Set rng = Range(Cells(ActiveCell.Row + 1, 1), Cells(Rows.Count, 1))
    rng.SpecialCells(xlCellTypeVisible).Cells(1).Select
     
    Ron de Bruin, Dec 11, 2004
    #2
    1. Advertisements

  3. danwPlanet

    Ron de Bruin Guest

    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, Dec 11, 2004
    #3
  4. danwPlanet

    danwPlanet Guest

    Wow! Nice, thanks!
    Dan
     
    danwPlanet, Dec 11, 2004
    #4
  5. danwPlanet

    morest38

    Joined:
    Feb 1, 2019
    Likes Received:
    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.
     
    morest38, Feb 1, 2019
    #5
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.
Thread Status:
Not open for further replies.