Check is a single row in Listobject is selected

neodjandre

Well-known Member
Joined
Nov 29, 2006
Messages
926
I am looking for a way to check if the user has selected a single cell or single row within a Listobject. If this is the case, then I would like to return the value from Column 1 of the Listobject for the particular row.

Not sure how to start with this one. any help is much appreciated.

many thanks
Andrew
 

Some videos you may like

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
41,024
Office Version
365
Platform
Windows
Maybe
Code:
Sub neojandre()
   Dim Tbl As ListObject
   On Error Resume Next
   Set Tbl = Selection.ListObject
   On Error GoTo 0
   If Not Tbl Is Nothing And Selection.Rows.Count = 1 Then
      MsgBox Intersect(Tbl.DataBodyRange.Columns(1), Selection.EntireRow)
   End If
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,099,684
Messages
5,470,121
Members
406,681
Latest member
sachinmasurkar

This Week's Hot Topics

Top