Consulting

Results 1 to 6 of 6

Thread: Solved: onchange event fired by deletion of row or adding row

  1. #1
    VBAX Tutor
    Joined
    Jun 2012
    Posts
    269
    Location

    Solved: onchange event fired by deletion of row or adding 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?

  2. #2
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,598
    Location
    [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

  3. #3
    VBAX Tutor
    Joined
    Jun 2012
    Posts
    269
    Location
    That is perfect. I am marking as solved. Thanks!

  4. #4
    Knowledge Base Approver VBAX Guru GTO's Avatar
    Joined
    Sep 2008
    Posts
    3,362
    Location
    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

  5. #5
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,598
    Location
    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

  6. #6
    Knowledge Base Approver VBAX Guru GTO's Avatar
    Joined
    Sep 2008
    Posts
    3,362
    Location
    Quote Originally Posted by Aflatoon
    ...However, like MS, I don't support XL 2000 any more.
    Ouch and ROFL!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •