Link to home
Create AccountLog in
Avatar of Murray Brown
Murray BrownFlag for United Kingdom of Great Britain and Northern Ireland

asked on

VB.net/VSTO Excel Add-in Handle row deletion event

Hi

I currently use the following event in my Excel VB.net Add-in to handle changes to cells.
How do I handle the deletion of Excel rows

Private Sub Application_SheetChange(Sh As Object, Target As Microsoft.Office.Interop.Excel.Range) Handles Application.SheetChange
Avatar of Rory Archibald
Rory Archibald
Flag of United Kingdom of Great Britain and Northern Ireland image

There is no event specifically for inserting or deleting rows. You can use a named range well below the data you expect and then monitor its row number when the target.columns.count = sheet.columns.count (which it has to if you are inserting / deleting rows). If the row number has decreased then a row has been deleted.
ASKER CERTIFIED SOLUTION
Avatar of Miguel Oz
Miguel Oz
Flag of Australia image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of Murray Brown

ASKER

Thanks very much