Seeking VBA Code for Cursor Movements

Ken1000

Active Member
Joined
Sep 28, 2003
Messages
315
Hi. I am using Excel 2000 and am new to using VBA.
What I need is the VBA code for simple cusor movements.
(These may sound crazy, but I have sound reasons
for needing this code.)

What is the VBA code to move the cursor (not the contents)
-- just the cursor ...
one cell DOWN ? one cell UP ? one cell to the RIGHT ?
one cell to the LEFT ?

Likewise, what is the VBA code to move 5 cells DOWN ?
5 cells UP ? 5 cells to the RIGHT ? 5 cells to the LEFT ?

Also, suppose a column is filled with 10 rows of data and
the cursor is at the top of the column/list. What VBA code
woudl move the cursor instantly DOWN to the END of that row
of data (to the 10th row). (Need to know what is the equiv.
of the manually applied END-DOWN keystroke sequence.)

Similarly, what is the VBA code for manually applied END-
RIGHT keystroke sequence.

Last, is there any web reference you can recommend which
shows coding examples for old Lotus 123 macro commands
to their equivalents in Excel 2000 VBA code ?

I know I've asked a lot. I truly appreciate any help you can
send my way.

Thanks very much ... Ken
 

Von Pookie

MrExcel MVP
Joined
Feb 17, 2002
Messages
13,686
Just some off the top of my head:

Move one cell down
ActiveCell.Offset(1, 0).Select

Move one cell up
ActiveCell.Offset(-1, 0).Select

Move one cell right
ActiveCell.Offset(0, 1).Select

Move one cell left
ActiveCell.Offset(0, -1).Select

To move more than one cell in any direction, simply change the 1 or -1 to however many cells you want to move over.

Equivalent of Ctrl+End
ActiveCell.SpecialCells(xlLastCell).Select

You can also use the macro recorder to experiment and see what code results from your actions in Excel.

Hope it at least gets you started,
 

Forum statistics

Threads
1,084,878
Messages
5,380,415
Members
401,673
Latest member
Ali Balleya

Some videos you may like

This Week's Hot Topics

Top