Visual Studio Developer Center >
Visual Studio Forums
>
Visual Studio Tools for Office
>
Changed event on cell?
Changed event on cell?
- Hi
I need a way to recalculate couple of cells only once, when one or several cell values are changed.
Are there any events triggering after a cell value is changed in Excel? I have looked at
SelectionChange but it triggers correctly only when single cell is changed. When I try to copy a cell value by dragging it to several other cells,
targeted cells will still have the old values.
Regards
A.I.- Changed TypeBessie ZhaoMSFT, ModeratorFriday, November 13, 2009 6:17 AM
- Changed TypeBessie ZhaoMSFT, ModeratorFriday, November 13, 2009 6:17 AM
All Replies
- Well, I see that SelectionChange do copy a value from a cell into other cells by dragging before SelectionChange event is triggered, so my bad. I didn't want to trigger correctly in my first case because I had a ListObject (which I had much problems with) containing a List, but never mind that.
But SelectionChange will of course not trigger if I mark several cells, edit first cell and press ctrl-enter to make changes on other marked cells. How can I handle this?
A.I. I need a way to recalculate couple of cells only once, when one or several cell values are changed.
Hello Allan,
I think you also could defined a namedRange for these cells [See: NamedRange Class]. If need to add a namedRange programmatically, please refer to this MSDN article: How to: Add NamedRange Controls to Worksheets. And then use Change event of this named range. When a cell in this namedRange, Change event will fire. Here is a thread which may interest you: How do I detect the cell data change on the excel grid.
For SelectionChange event, please see this MSDN article: Worksheet.SelectionChange Event.
Best regards,
Bessie
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.Standard way is to intercept the WorksheetChange event, Unless you've created a .Net Tool NamedRange object on the sheet, in which case you'd be able to intercept the NamedRange Change event, but that doesn't sound like your scenario.
We are changing the issue type to "General Discussion" because you have not followed up with the necessary information. If you have more time to look at the issue and provide more information, please feel free to change the issue type back to "Question" by opening the Options list at the top of the post window, and changing the type. If the issue is resolved, we will appreciate it if you can share the solution so that the answer can be found and used by other community members having similar questions.
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.


