Row deletion event: identifying deleted row ID

  • Thread starter Thread starter faffo1980
  • Start date Start date
F

faffo1980

Hi all,
I would like to know if there is a way to identify which is the index of a
row deleted from the sheet.
Browsing the web I found some method to identify a row deletion event but
not the row index.

Thanks in advance for the help,

faffo1980
 
Once you havw determined that a row has been deleted:

MsgBox Target.Row

will identify the row
 
Try the below to track row deletions from the used range...Select the sheet
tab which you want to work with. Right click the sheet tab and click on 'View
Code'. This will launch VBE. Paste the below code to the right blank portion.
Get back to to workbook and try out.

Private Sub Worksheet_Change(ByVal Target As Range)
Static lngRows As Long
If UsedRange.Rows.Count < lngRows Then
MsgBox "Row " & Target.Row & "deleted"
End If
lngRows = Me.UsedRange.Rows.Count
End Sub

If this post helps click Yes
 
It works...
Thanks a lot!

faffo1980


Jacob Skaria said:
Try the below to track row deletions from the used range...Select the sheet
tab which you want to work with. Right click the sheet tab and click on 'View
Code'. This will launch VBE. Paste the below code to the right blank portion.
Get back to to workbook and try out.

Private Sub Worksheet_Change(ByVal Target As Range)
Static lngRows As Long
If UsedRange.Rows.Count < lngRows Then
MsgBox "Row " & Target.Row & "deleted"
End If
lngRows = Me.UsedRange.Rows.Count
End Sub

If this post helps click Yes
 
Back
Top