Setting focus to specific cells

L

Lluis Escude

I want the focus to be automatically placed on a specific
cell when the current cell is left, e.g. I'm in b16 and
when I hit the tab or the enter key I want the cursor to
be at, say, d23. How can I write a macro for that?
 
A

Arvi Laanemets

Hi

A quote:
Tom Ogilvy said:
select your cells in the order you desire, starting with the second cell in
the sequence and ending with the first. Hold the control key down while you
do this to expand the selection.

Then go to the name box in the upper left corner and enter

Order1

and hit return

This names the select range Order1 (use any legal name you want).


If you use just the tab key, you will tab through the range in the same
order you selected the cells. Any time you need to do this, select the
defined name from the name box dropdown.


Arvi Laanemets
 
A

Andy Brown

How can I write a macro for that?

You can if you like, but there's no need. You can define a named range if
your input cells and tab thru that.

Say your input cells are A1, C1 and E1. Holding down CTRL, click on C1 then
E1 then A1 (so you must select them in entry order, except that the first
cell must be selected last). Click in the Name Box (left of formula bar),
then type eg: "Input" (w/out the quotes), then press Enter. Then you can
select the range via the Name Box and tab or Enter thru.

Rgds,
Andy
 
A

Andy Brown

Now, how about doing the same thing when the Enter
(Return) key is hit?

Works the same for tab and both Enters on my k/b. Did you try it?

Also, you wanna be careful mentioning S*ndK*ys round these parts, you'll
annoy the gurus.

Rgds,
Andy
 
G

Guest

Is there any way that
this name be selected automatically when the spreadsheet
is started?

OK, I've finally done it in the Workbook_Open sub.

Thanks anyway.
 

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