ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Worksheet Listbox selected item? (https://www.excelbanter.com/excel-programming/415640-worksheet-listbox-selected-item.html)

Webtechie

Worksheet Listbox selected item?
 
Hello,

I've created a listbox (lstImportFiles) on my worksheet (admin).

I have the range and the cell link (b2).

The value of B2 is 3. Now how do I get the value of the selected list item
for the worksheet listbox? I didn't quite get that by searching this forum.
Maybe I missed it, but I didn't see threads on retrieving the selected item
in a Worksheet listbox.

Thanks.



JLGWhiz

Worksheet Listbox selected item?
 
Sub fk()
MsgBox Sheet1.ListBox1.Value
End Sub


"Webtechie" wrote:

Hello,

I've created a listbox (lstImportFiles) on my worksheet (admin).

I have the range and the cell link (b2).

The value of B2 is 3. Now how do I get the value of the selected list item
for the worksheet listbox? I didn't quite get that by searching this forum.
Maybe I missed it, but I didn't see threads on retrieving the selected item
in a Worksheet listbox.

Thanks.



JLGWhiz

Worksheet Listbox selected item?
 
P.S. I assumed a single column, single select list box. If multicolumn,
single select, the code would return the value of the bound column. If
multiselect the code fails.

"Webtechie" wrote:

Hello,

I've created a listbox (lstImportFiles) on my worksheet (admin).

I have the range and the cell link (b2).

The value of B2 is 3. Now how do I get the value of the selected list item
for the worksheet listbox? I didn't quite get that by searching this forum.
Maybe I missed it, but I didn't see threads on retrieving the selected item
in a Worksheet listbox.

Thanks.



Webtechie

Worksheet Listbox selected item?
 
Hey,

That didn't work:

I tried:


Sheets("DataValues").Select
Range("j3").Value = Sheets("adminview").Shapes("lstImportFiles").Value

I got:


Run time error '438'
Object doesn't support this property or method.




"JLGWhiz" wrote:

P.S. I assumed a single column, single select list box. If multicolumn,
single select, the code would return the value of the bound column. If
multiselect the code fails.

"Webtechie" wrote:

Hello,

I've created a listbox (lstImportFiles) on my worksheet (admin).

I have the range and the cell link (b2).

The value of B2 is 3. Now how do I get the value of the selected list item
for the worksheet listbox? I didn't quite get that by searching this forum.
Maybe I missed it, but I didn't see threads on retrieving the selected item
in a Worksheet listbox.

Thanks.




All times are GMT +1. The time now is 10:04 AM.

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