How to generate cell click event in Excel 2007 VSTO with VB?

Well, I looked at application events in Excel 2007, but I can not find any event generated when I click on a cell.
Currently, I cannot use the double-click event due to application limitations.
Is there a way to create a custom click event and attach it to a worksheet to create a cell click event.

+4
source share
1 answer

You can catch this through the Worksheet.SelectionChange event, as shown in the snippet below. If you are interested in individual cells, you may need to make sure that the range is one cell.

private void ThisAddIn_Startup(object sender, System.EventArgs e) { var sheet = this.Application.ActiveSheet as Excel.Worksheet; sheet.SelectionChange += new Excel.DocEvents_SelectionChangeEventHandler(sheet_SelectionChange); } void sheet_SelectionChange(Excel.Range Target) { MessageBox.Show("Changed!"); } 
+3
source

Source: https://habr.com/ru/post/1308583/


All Articles