Worksheet change event

merry_fay

Board Regular
Joined
Oct 28, 2010
Messages
54
Hi,

I'm trying to run an event on the cell that has been changed in a worksheet change event.
This works in my excel where I don't move the cursor after enter, but when my colleagues use it, it then looks at the wrong cell because they move after enter.

Is there a way to say 'go to the last cell changed'?

I've got the code for Application.MoveAfterReturn = False but this will leave their setting changed (or if I set it back to true, change mine!!).

Thanks
merry_fay
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Can you please post your current code, as well as what exactly the code is meant to do? By the sounds of it, you are using Worksheet_SelectionChange, not Worksheet_Change.
 
Upvote 0
OK, I think I worded it badly. I am definitely using worksheet_change.

The problem is in the end user's preferred settings.
After enter move cell down/up/left/right/don't move it.....

My macro involves using the cell that has just been changed so I need to refer to that cell (set it as activecell) regardless of the end user's settings.

Thanks
 
Upvote 0
You should be referring to Target not Activecell. Would be easier if you posted the code... ;)
 
Upvote 0
If you use Worksheet_Change(ByVal Target as Range), then Target will be the cell that was changed.

Can you please post your entire code?
 
Upvote 0
OK, I think I worded it badly. I am definitely using worksheet_change.

The problem is in the end user's preferred settings.
After enter move cell down/up/left/right/don't move it.....

My macro involves using the cell that has just been changed so I need to refer to that cell (set it as activecell) regardless of the end user's settings.

Thanks

More precisely -on my laptop, I change a cell, hit enter & the activecell is still the cell I changed, on my colleagues laptops, they make a change, hit enter & the activecell is the one below the changed one.
Alternatively, someone could just type in a cell then click elsewhere without using enter.

I need to refer back to the cell just changed.

Thanks
merry_fay
 
Upvote 0
More precisely -on my laptop, I change a cell, hit enter & the activecell is still the cell I changed, on my colleagues laptops, they make a change, hit enter & the activecell is the one below the changed one.

Click Tools - Options - check "Move selection after Enter" - Select Down


I need to refer back to the cell just changed.

As stated above, Target is the cell(s) that was changed. Regardless of what cell is currently active.



If you want better help....post your code.
 
Upvote 0
I think my point is still not being got.

It's not a case of changing the settings, I can't give a spreadsheet out to end users & ask them all to change their preferred settings, I need to make the code deal with their preferred settings.
As I said before, I could use Application.MoveAfterReturn = False but I would very fast become very unpopular!!!


In eg cell B9, the number 2 is typed.
The end user might then press enter & the active cell then moves or not depending on their settings, or the end user might just click in eg A1.

The macro needs to use the value in cell B9 so how do I get it to refer to B9 (in this instance, in another it might be D25)

Thanks
 
Upvote 0
I think it is you who are not getting the point.
The Change event provides you a range object called Target as an argument. This is the cell(s) that has (have) been changed. You need to refer to Target in your code and not to Activecell.
Once again, if you posted the code this would be much simpler...
 
Upvote 0

Forum statistics

Threads
1,224,559
Messages
6,179,517
Members
452,921
Latest member
BBQKING

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top