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 does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
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,223,885
Messages
6,175,187
Members
452,616
Latest member
intern444

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