tags:

views:

40

answers:

1

Well I have browsed through Application events in Excel 2007 however I can't find any event generated on a cell click.
I can't use a double click event at the moment due to application constraints.
Is there a way I can create a custom click event and attach it to a sheet for generating a cell click event.

+1  A: 

You should be able to capture that through the Worksheet.SelectionChange event, as illustrated in the snippet below. If you are interested in single cells, you may have to make sure that the range is a single 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!");
}
Mathias
Works like a charm! Thanks!!
Kevin Boyd