mongoose
03-09-2020, 02:11 PM
Hello,
I am trying to call a function anytime a cell changes within a certain column inside of a table. But, I need to call that column by it's column name and not index. Here is the code I have so far but I keep getting an "Object Required" error.
Here is my code..
Private Sub Worksheet_Change(ByVal Target As Range) 'Instansiate ListObject
Dim tbl As ListObject
Set tbl = Worksheets("Prod. Data").ListObjects("Table3")
Dim KeyCells As ListColumns
Set KeyCells = tbl.ListColumns("Shipping Method").Range.Select
' The variable KeyCells contains the cells that will cause an alert when they are changed.
'Set KeyCells = Range("A1:C10")
If Not Application.Intersect(KeyCells, Range(Target.Address)) Is Nothing Then
' Display a message when one of the designated cells has been changed. Place your code below.
MsgBox "Cell " & Target.Address & " has changed."
End If
End Sub
Thank you everyone.
I am trying to call a function anytime a cell changes within a certain column inside of a table. But, I need to call that column by it's column name and not index. Here is the code I have so far but I keep getting an "Object Required" error.
Here is my code..
Private Sub Worksheet_Change(ByVal Target As Range) 'Instansiate ListObject
Dim tbl As ListObject
Set tbl = Worksheets("Prod. Data").ListObjects("Table3")
Dim KeyCells As ListColumns
Set KeyCells = tbl.ListColumns("Shipping Method").Range.Select
' The variable KeyCells contains the cells that will cause an alert when they are changed.
'Set KeyCells = Range("A1:C10")
If Not Application.Intersect(KeyCells, Range(Target.Address)) Is Nothing Then
' Display a message when one of the designated cells has been changed. Place your code below.
MsgBox "Cell " & Target.Address & " has changed."
End If
End Sub
Thank you everyone.