ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how to set activecell? (https://www.excelbanter.com/excel-programming/282868-how-set-activecell.html)

ljb[_2_]

how to set activecell?
 
I have a worksheet_change event function that behaves differently based on a
value typed into a cell verses pasted into a cell. If I paste in a value the
activecell doesn't change. If I type a value and hit enter the activecell
moves down one row. How can I set the activecell to be the one I just moved
from?

thanks
LJB



Harald Staff

how to set activecell?
 
Hi

One brutal way is

Private Sub Worksheet_Change(ByVal Target As Range)
'whetever here, and finally:
Target.Select
End Sub

But whether the cursor moves on Enter or not is really the choice of each user, defined in
the Tools Options Edit Move cursor after entry. And user preferences should in my
opinion be overridden only when absolutely necessary ... that is when the users are idiots
.... which is almost always ...<bg
--
HTH. Best wishes Harald
Followup to newsgroup only please.

"ljb" <. wrote in message ...
I have a worksheet_change event function that behaves differently based on a
value typed into a cell verses pasted into a cell. If I paste in a value the
activecell doesn't change. If I type a value and hit enter the activecell
moves down one row. How can I set the activecell to be the one I just moved
from?

thanks
LJB





ljb[_2_]

how to set activecell?
 
Thanks, got me going again.

Looking at help I find it suggests using Target.Activate if its a single
cell over Target.Select. Both seem to work for me.

thanks
LJB




All times are GMT +1. The time now is 06:09 PM.

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