Row deletion event: identifying deleted row ID

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
 
G

Gary''s Student

Once you havw determined that a row has been deleted:

MsgBox Target.Row

will identify the row
 
J

Jacob Skaria

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
 
F

faffo1980

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top