move cursor to empty row ?

J

Joel

There is no commands that stops on an empty row. Excel stops on data.
You can get either the last cell of the curent region or the last cell used
on the worksheet. Then you can increment to the next row

set LastCell = ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell)
LastRow = LastCell.Row
EmptyRow = LastRow + 1
 
B

Bob Bridges

Actually there may be one thing you can do, depending on what your data looks
like: You can simulate the <End><Down> key sequence. On your keyboard if
your selected cell has data in it and you hit <End> and then one of the arrow
keys, Excel moves the selection to the next empty cell in that direction. If
the selected cell is empty, Excel stops at the first non-blank cell. "Blank"
and "non-blank" in this case refer to cells with no formulae in them;
formulae that display nothing still count as data for the purpose of this
command.

To do this in your program try the End method of a range. You may have to
look up the details, but I think it works like this:

Set EmptyCell = ActiveCell.End(xlDown)
MsgBox "Row " & EmptyCell.Row & " is the first empty row."

Of course End looks for empty (or non-empty) cells, not rows, but if you
know where your data is this often will work for you.
 

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