I need to fire an alert when a user adds or deletes a row in a sheet. I figure the best way to do this is through the onchange event procedure. Is there a test to see if the user deleted or added an entire row?
I need to fire an alert when a user adds or deletes a row in a sheet. I figure the best way to do this is through the onchange event procedure. Is there a test to see if the user deleted or added an entire row?
[vba]Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Rows(1).Cells.Count = Columns.Count Then
MsgBox "entire row affected"
End If
End Sub
[/vba]
should work.
Be as you wish to seem
That is perfect. I am marking as solved. Thanks!
Hi Aflatoon
Probably of no consequence whatsoever, but just in case of an Excel 2000 user...
In 2000, the deletion of a row will get trapped, but the insertion of a row will not. (I do not know, or do not recall why this anomoly existed, just that XLD or Malcom verified it for me quite some time ago.)
Hope all is well in your corner of the world,
Mark
Hi Mark,
Thanks for the heads-up. However, like MS, I don't support XL 2000 any more.
All cool here. Unfortunately, literally so.
Be as you wish to seem
Ouch and ROFL!Originally Posted by Aflatoon