If a Row is inserted or is a row is deleted then......
no. but maby a workaround :
If u have a value somwhere in lasteow, Excel automatic create an error
so my code only take care of deleting rows.
First put this formula in cell A65536
=row()
select cell A65536
name this cell as RowLast
Put the folowing code in ur sheet-code-module (Change Ark1 to ur sheetname)
Private Sub Worksheet_Change(ByVal Target As Range)
If [Ark1!RowLast].Value < 65536 Then
If MsgBox("Warning...ok to delete row ? ", vbYesNo) = vbNo Then
Application.Undo
Else
Range("A65535").Cut Destination:=Range("A65536")
End If
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If [Ark1!RowLast].Value < 65536 Then
If MsgBox("Warning...ok to delete row ? ", vbYesNo) = vbNo Then
Application.Undo
Else
Range("A65535").Cut Destination:=Range("A65536")
End If
End If
End Sub
"ML" skrev:
Hi I was wondering if there is a function out there that will allow me to
catch a row added and a row deleted event.
If a row is deleted then
code
If a row is inserted Then
code
End if
End if
Anyone have something like this?
Thank you,
Mark
|