#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 94
Default Listbox 2

Ok. So I have this multi-column listbox.
I've figured out how to tell which row is clicked.

Private Sub ListBox1_Click()
MsgBox ListBox1.ListIndex
End Sub

Is there a way to tell which column is clicked?

Thanks,
Tim


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default Listbox 2

Not sure how you are clicking a column, a selection is for the whole row.
You can however access each column of data item by using the List property.
Where List(row,column) can be used.

Sinple procedure to access each column item for the row in the listbox that
is clicked follows.....

Private Sub ListBox1_Click()
Dim ic As Integer
With ListBox1
For ic = 0 To .ColumnCount - 1
Debug.Print .List(.ListIndex, ic)
Next ic
End With
End Sub

Cheers
Nigel

"Tim Coddington" wrote in message
...
Ok. So I have this multi-column listbox.
I've figured out how to tell which row is clicked.

Private Sub ListBox1_Click()
MsgBox ListBox1.ListIndex
End Sub

Is there a way to tell which column is clicked?

Thanks,
Tim




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Listbox 2

Tim,

You select a row, not a column. You can get at all values in the row like
so

MsgBox "Column 1: " & ListBox1.Value

MsgBox "Column 2: " & ListBox1.List(ListBox1.ListIndex, 1)


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Tim Coddington" wrote in message
...
Ok. So I have this multi-column listbox.
I've figured out how to tell which row is clicked.

Private Sub ListBox1_Click()
MsgBox ListBox1.ListIndex
End Sub

Is there a way to tell which column is clicked?

Thanks,
Tim




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 94
Default Thanks Listbox 2

Thanks folks, I guess I'll just need to pack to list boxes together and
divine by which list box they choose.
"Bob Phillips" wrote in message
...
Tim,

You select a row, not a column. You can get at all values in the row like
so

MsgBox "Column 1: " & ListBox1.Value

MsgBox "Column 2: " & ListBox1.List(ListBox1.ListIndex, 1)


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Tim Coddington" wrote in message
...
Ok. So I have this multi-column listbox.
I've figured out how to tell which row is clicked.

Private Sub ListBox1_Click()
MsgBox ListBox1.ListIndex
End Sub

Is there a way to tell which column is clicked?

Thanks,
Tim






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
listbox B conditional of input in Listbox A Kim K Excel Discussion (Misc queries) 1 October 31st 06 08:27 PM
Multicolumn Listbox and ordinary listbox Ron_D Excel Programming 0 June 4th 04 08:56 PM
listbox.value not equal to listbox.list(listbox.listindex,0) ARB Excel Programming 0 October 22nd 03 12:46 AM
Is refreshing listbox rowsource in listbox click event possible? Jeremy Gollehon[_2_] Excel Programming 4 September 25th 03 06:45 PM
Sorting ListBox results or transposing ListBox values to other cells for sorting Rob[_8_] Excel Programming 1 July 9th 03 04:35 AM


All times are GMT +1. The time now is 05:58 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"