How do I capture the user deleting a row, is this an event?
How do I capture the user deleting a row, is this an event?
This will capture when any row less than row 2000 is deleted, when put in the sheet's code module. However, the Calculate event won't be triggered unless there is a formula on the sheet.
If the formula =COUNTA(A:A) is somewhere on the page, this will trigger when a row is either added or deleted above row 2000.![]()
Private Sub Worksheet_Calculate() If Range("oneColumn").Row < 2000 Then MsgBox "row deleted" End If Range("2000:2000").Name = "oneColumn" End Sub
The key to this is finding the functions to trigger the Calculate event. COUNTA(A:A) is excelent since it recalculates whenever a cell is removed or added to column A.![]()
Private Sub Worksheet_Calculate() If Range("oneColumn").Row < 2000 Then MsgBox "row deleted" End If If Range("oneColumn").Row > 2000 Then MsgBox "row add" End If Range("2000:2000").Name = "oneColumn" End Sub
_
...How to Cross-post politely...
..Wrap code by selecting the code and clicking the # or read this. Thank you.
thanks for the solution
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks