View Single Post
 
Old 12-24-2017, 08:15 AM
NoSparks NoSparks is offline Windows 7 64bit Office 2010 64bit
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 842
NoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of light
Default

What you're looking for is the Worksheet_SelectionChange event.

Right click the sheet tab then View Code.
Select Worksheet from the drop down where it probably says (General).
All the different worksheet events will now appear in the other drop down.

This assumes that what you are referring to as a table is in fact an Excel table, not a standard range.
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

'limit to single cell selection
If Target.Count > 1 Then Exit Sub

'limit to the first column of data in the first table on the sheet
If Intersect(Target, Me.ListObjects(1).ListColumns(1).DataBodyRange) Is Nothing Then
    Exit Sub
Else
    ' do what's required
    ' for example
    MsgBox "The sheet address of the cell you just entered is " & Target.Address
    '
    '
End If
    
End Sub
Hope this helps.
Reply With Quote