Macro That Moves Cursor Down

J

job1job1

When recording a macro to capture keystrokes, how do I get the curso
(or active cell) to be at the next blank cell at the bottom of
column of data?

In other words, when I use End+Down and then move the arrow key dow
one more cell, the macro record function identifies that cell by name
such as A24, rather than End+Down and then Down.

Thanks for your expertise
 
R

Ron de Bruin

Hi
(or active cell) to be at the next blank cell at the bottom of a
column of data?

Two ways

Range("A" & Rows.Count).End(xlUp)(2).Select

Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Select
 
T

Tom Ogilvy

ActiveCell.End(xldown).Select
if Activecell.row <> 65536 then
Activecell.offset(1,0).Select
else
ActiveCell.End(xlup).Offset(1,0).Select
End if

or
if isempty(activeCell.Offset(1,0)) then
Activecell.offset(1,0).Select
else
ActiveCell.End(xldown).Offset(1,0).Select
End if
 
G

Gord Dibben

job

Sub select_last_plus_one()
Dim rng As Range
Set rng = Cells(Rows.Count, 1).End(xlUp)(2)
'or .End(xlUp).Offset(1, 0)
rng.Select
End Sub

The (Rows.Count, 1) denotes column A

Gord Dibben Excel MVP
 

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