LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Selected ListBox item to TextBox

Let me put it in another way...
I have a ListBox which I populate with the additem "method". The ListBox has
14 column.
I would like to extract the value of each column of the selected item into
TextBoxes that are in an other Useform...
The here below code you gave me works fine until the 9th column:

Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
UserForm2.TextBox1 = ListBox1.List(ListBox1.ListIndex, 9)
End Sub

When willing to retreive the value of the 10th column and above it doesn't
work anymore. In clear words, the here below code doesn't work

Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
UserForm2.TextBox1 = ListBox1.List(ListBox1.ListIndex, 10)
End Sub


Rick Rothstein wrote:
What do you mean by "a value that is above the 9th column"? And what is the
"i" variable for? The code I posted was meant to replace all of your code
(notice I posted the event header and the End Sub statements with my single
line of code)... it was not meant to be merged with the code you posted.
Because you are using the DblClick event, the selected row will be the row
that the user double clicks on... the ListIndex that I used as an argument
for the List property returns that row number directly (where the first row
is numbered 0)... no loop is necessary to find it. Again, the code you will
actually need will depend on the first question I asked you above (and on
what "above" means in it).

Hi Rick...
First of all, thanks for this fast reply.

[quoted text clipped - 20 lines]
Thank you in advance for your help
Honnore


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200904/1



 
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
Worksheet Listbox selected item? Webtechie Excel Programming 3 August 14th 08 08:27 PM
Delete selected Item from listbox Office_Novice Excel Programming 2 May 1st 08 03:12 PM
How to get the index in VBA of the selected item in a ListBox Stefan Mueller[_2_] Excel Programming 4 July 16th 07 07:19 PM
Need selected item from listbox after double click [email protected] Excel Programming 1 February 23rd 06 03:18 PM
Count number of selected item in Listbox Todd Huttenstine Excel Programming 4 June 14th 04 06:54 PM


All times are GMT +1. The time now is 05:00 AM.

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

About Us

"It's about Microsoft Excel"