ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Row deletion event: identifying deleted row ID (https://www.excelbanter.com/excel-programming/435948-row-deletion-event-identifying-deleted-row-id.html)

faffo1980

Row deletion event: identifying deleted row ID
 
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

Gary''s Student

Row deletion event: identifying deleted row ID
 
Once you havw determined that a row has been deleted:

MsgBox Target.Row

will identify the row
--
Gary''s Student - gsnu200908


"faffo1980" wrote:

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


Jacob Skaria

Row deletion event: identifying deleted row ID
 
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
---------------
Jacob Skaria


"faffo1980" wrote:

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


faffo1980

Row deletion event: identifying deleted row ID
 
It works...
Thanks a lot!

faffo1980


"Jacob Skaria" wrote:

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
---------------
Jacob Skaria


"faffo1980" wrote:

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



All times are GMT +1. The time now is 05:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com