You can try the following:
Write this code in this book.
Private Sub Workbook_Open() Set ref_tbl = Sheet1.ListObjects(1).DataBodyRange End Sub
Then under the code in the Worsksheet object.
Private Sub Worksheet_SelectionChange(ByVal Target As Range) On Error GoTo halt Application.EnableEvents = False Dim tbl_rng As Range Set tbl_rng = Me.ListObjects(1).DataBodyRange If Not Intersect(Target, tbl_rng) Is Nothing Then If tbl_rng.Rows.Count > ref_tbl.Rows.Count Then MsgBox "Table increase in size" '~~> Do your stuff here Set ref_tbl = tbl_rng End If End If forward: Application.EnableEvents = True Exit Sub halt: MsgBox Err.Number & ": " & Err.Description Resume forward End Sub
You will also need a module to declare a public variable.
Public ref_tbl As Range
So basically, this will tell you when your table will increase in size.
If we can catch it, then you can do your things when this condition is met.
This works in the situation that you describe in your question.
This will not work if you insert a row between the records in the table. Anyway, hth.
source share