Excel Macros

S

steve thomas

Does anybody know how, when recording a macro, you get
the macro to recognise arrow key movements. (i.e. to
recognise up 1, down 1 etc instead of selecting a
specific cell)
 
B

Bill Lunney

This can't be done.

Look at the Offset command. This may help.

If the intention is to perform an operation on cells which are a particular
distance (offset) away from a known origin then perhaps recording a macro,
using it as a base then making use of the Offset command will help you
achieve the same result.


--

Regards,


Bill Lunney
www.billlunney.com
 
J

Jerry W. Lewis

Two ways to move 1 cell right are

Selection.Offset(0, 1).Select
ActiveSheet.Cells(Selection.Row, Selection.Column + 1).Select

Other directions should be obvious.

Jerry
 
M

Mike

Macro recordings are very limited to what they do. They
don't recogize arrow keys or mouse clicks as you would
expect. As you have seen they just recognize which cells
are being selected, or that a selection is being
modified. In order to get a macro to move the selection
to the left, right, up or down, you will need to edit the
macro and use one of the following commands.

This will move the selection one cell to the right
ActiveCell.Offset(0, 1).Activate

This will move it one cell to the left.
ActiveCell.Offset(0, -1).Activate

One down.
ActiveCell.Offset(1, 0).Activate

And one up.
ActiveCell.Offset(-1, 0).Activate
 
D

Debra Dalgleish

Before you press the arrow key, click the Relative Reference button on
the Stop Recording toolbar.

Click it again, when you want to record a specific cell reference.
 

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