View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Bob Bridges Bob Bridges is offline
external usenet poster
 
Posts: 108
Default move cursor to empty row ?

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.

--- "Joel" wrote:
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

--- "Eng Teng" wrote:
What is the command to move cursor to empty row ?