ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Detect Delete Column/Row vs Insert (https://www.excelbanter.com/excel-programming/359385-detect-delete-column-row-vs-insert.html)

Otto Moehrbach

Detect Delete Column/Row vs Insert
 
Excel 2002, WinXP
I am helping an OP and I have run into something that I need some help with.
His file has some key words located here and there that some code I wrote is
using to locate things. No problem with that.
His problem is that his user might delete a column/row that contains one or
more of these key words, and thereby mess up the operation of the code. His
user is permitted to delete/insert columns and rows and does so.
So I wrote him some code based on a Worksheet_Change macro and Undo and
check for those words, etc. That works fine.
But I didn't consider that this code will fire when the user INSERTS a
column/row as well. That results in bad things happening.
My question: Is there any way to detect that the change (Worksheet_Change)
was an insertion rather than a deletion of a column/row?
Thanks for your help. Otto




All times are GMT +1. The time now is 06:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com