Move curser left one cell

P

Patrick C. Simonds

When I click on the finished button on my dialog box I would like the focus
to move left by 1 cell. So if cell E4 is active I want cell D4 to become
active.
 
A

anon

If you dialog box is closed by you clicking a button there will be
code to close it i presume.

Therefore make the last line of the code,

sheets("sheet1").range("d4").activate

or

activecell.offset(0,-1).select
 
N

Neptune Dinosaur

G'day

If you don't know where the cursor is going to be at any given time, the
generic way of achieveing this is :

Activecell.Offset(0,-1).Select

The first co-ordinate for an offset is for Row - in this case you want to
stay on the same row so you use 0. The second co-ordinate is for Column. To
go 1 column to the left you use -1. You'll have to be careful to allow for
the possibility that the active cell is in row A. Trying to go left from
there will give you a run time error.
 
N

Neptune Dinosaur

Just to correct what I wrote before -

It should say " .. if the active cell is in column A" (not "row A").
 

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