View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Lukasz Lukasz is offline
external usenet poster
 
Posts: 1
Default Updating synchronized spreadsheets

Hello

I've got a simple .net application with two excel spreadsheets
(AxSpreadsheet). A change in one triggers a SheetChange event updating the
other spreadsheet. My sheetchange event handler is the following:

private void axSpreadsheet1_SheetChange(object sender,
AxMicrosoft.Office.Interop.Owc11.ISpreadsheetEvent Sink_SheetChangeEvent e)
{
if (sender == null || e == null)
{
return;
}
foreach(Range cell in e.target)
{
axSpreadsheet2.Cells.get_Item(cell.Row,cell.Column ).Value2 =
cell.Value2;
}
}

It works fine with simple editing of cells and copy/pasting, but when I
delete a row or a column, the method goes through all the cells in the sheet,
resulting in a freeze of the application. What's the smart way to do it? I
appreciate all your suggestions.

Regards,