ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Extracting choice from a ListBox (https://www.excelbanter.com/excel-programming/331880-extracting-choice-listbox.html)

davey[_2_]

Extracting choice from a ListBox
 

This is my first post.

When using a ListBox with the "Option" style (as opposed to "Plain"),
how do you write the code to test for which item was selected, so that
it can be used in another part of the subroutine or module?

Thanks!

- Dave


--
davey
------------------------------------------------------------------------
davey's Profile: http://www.excelforum.com/member.php...o&userid=24340
View this thread: http://www.excelforum.com/showthread...hreadid=379411


Bob Phillips[_7_]

Extracting choice from a ListBox
 
Listbox1.Value just the same.

--
HTH

Bob Phillips

"davey" wrote in
message ...

This is my first post.

When using a ListBox with the "Option" style (as opposed to "Plain"),
how do you write the code to test for which item was selected, so that
it can be used in another part of the subroutine or module?

Thanks!

- Dave


--
davey
------------------------------------------------------------------------
davey's Profile:

http://www.excelforum.com/member.php...o&userid=24340
View this thread: http://www.excelforum.com/showthread...hreadid=379411




Toppers

Extracting choice from a ListBox
 
Hi,
Add code similar to this to your userform:

Private Sub ListBox1_Click()
Worksheets("Sheet1").Range("a1")=ListBox1.value ' Assign data to cell
a1 in Sheet1
End Sub


HTH

"davey" wrote:


This is my first post.

When using a ListBox with the "Option" style (as opposed to "Plain"),
how do you write the code to test for which item was selected, so that
it can be used in another part of the subroutine or module?

Thanks!

- Dave


--
davey
------------------------------------------------------------------------
davey's Profile: http://www.excelforum.com/member.php...o&userid=24340
View this thread: http://www.excelforum.com/showthread...hreadid=379411



davey[_3_]

Extracting choice from a ListBox
 

Hi again,

I didn't see the Forum Search button before submitting the origina
post about extracting data from a listbox.

I found it, then did a search, and found a post by Harald Staff o
6-08-05 that gave me the help I needed, in a thread called "Choosin
Items in a Listbox".

This is great!

- Dave

--
dave
-----------------------------------------------------------------------
davey's Profile: http://www.excelforum.com/member.php...fo&userid=2434
View this thread: http://www.excelforum.com/showthread.php?threadid=37941


davey[_4_]

Extracting choice from a ListBox
 

Thank You Bob & Toppers! Those are very helpful, and seem eve
easier.

- Dave

--
dave
-----------------------------------------------------------------------
davey's Profile: http://www.excelforum.com/member.php...fo&userid=2434
View this thread: http://www.excelforum.com/showthread.php?threadid=37941



All times are GMT +1. The time now is 10:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com