ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Move curser left one cell (https://www.excelbanter.com/excel-programming/409270-move-curser-left-one-cell.html)

Patrick C. Simonds

Move curser left one cell
 
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.


anon

Move curser left one cell
 
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

Neptune Dinosaur

Move curser left one cell
 
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.


--
Time is just the thing that keeps everything from happening all at once


"anon" wrote:

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



All times are GMT +1. The time now is 10:45 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com