Table (ListObject Object) Change Event

wsnyder

Board Regular
Joined
Sep 23, 2018
Messages
224
Office Version
  1. 365
Platform
  1. Windows
Hi,

Using Excel 365.

Is there such a thing as Table (ListObject Object) Change Event or something better than Worksheet Change Event?
I have a Table on a worksheet. A user can enter a new item which triggers the code to sort the table and remove any duplicates.
However, I need to add a second table to the sheet.
It does not seem "elegant" to fire the code on Table1 when the only think the user changed was Table2.

Thanks,
-w
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
It does not seem "elegant" to fire the code on Table1 when the only think the user changed was Table2.
You can establish which table the change was in like this
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)

If Target.CountLarge > 1 Then Exit Sub

If Not Intersect(Target, ActiveSheet.ListObjects(1).Range) Is Nothing Then
    ' do what's required, message for demo purpose
    MsgBox "The change was part of the FIRST table"
End If

If Not Intersect(Target, ActiveSheet.ListObjects(2).Range) Is Nothing Then
    ' do what's required, message for demo purpose
    MsgBox "The change was part of the SECOND table"
End If

End Sub
 
Upvote 0
Did you manage to find anything such as a Table (ListObject Object) Change Event ?
Or anything more 'elegant' than a single If-Then statement ?
 
Upvote 0

Forum statistics

Threads
1,224,814
Messages
6,181,128
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top