ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   List Box Value To Worksheet Cell (https://www.excelbanter.com/excel-programming/352658-list-box-value-worksheet-cell.html)

MWS

List Box Value To Worksheet Cell
 
Hello, Can someone tell me how I can take the value selected from a listbox
and place it in a particular worksheet cell?

Upon activating "Sheet4" in the file, I have a userform, which contains a
listbox (lstTeamNumbers), presented. On the userform, upon "clicking" the
cmdTeam control, I have the following:

lstTeamNumbers.Value = Range("bb1").Value
frmTeamQuery.Hide

After the code executes, there is no value populated in cell "bb1".

Any and All Help Will Be Appreciated


Jim Thomlinson[_5_]

List Box Value To Worksheet Cell
 
You are setting the value of the list box to whatever is in
Range("bb1").Value on the active sheet. If I understand you correctly you
want it the other way around...

Range("bb1").Value = lstTeamNumbers.Value
--
HTH...

Jim Thomlinson


"MWS" wrote:

Hello, Can someone tell me how I can take the value selected from a listbox
and place it in a particular worksheet cell?

Upon activating "Sheet4" in the file, I have a userform, which contains a
listbox (lstTeamNumbers), presented. On the userform, upon "clicking" the
cmdTeam control, I have the following:

lstTeamNumbers.Value = Range("bb1").Value
frmTeamQuery.Hide

After the code executes, there is no value populated in cell "bb1".

Any and All Help Will Be Appreciated


MWS

List Box Value To Worksheet Cell
 
Thank You Jim - WOW I Must Need A Break (LOL)

"Jim Thomlinson" wrote:

You are setting the value of the list box to whatever is in
Range("bb1").Value on the active sheet. If I understand you correctly you
want it the other way around...

Range("bb1").Value = lstTeamNumbers.Value
--
HTH...

Jim Thomlinson


"MWS" wrote:

Hello, Can someone tell me how I can take the value selected from a listbox
and place it in a particular worksheet cell?

Upon activating "Sheet4" in the file, I have a userform, which contains a
listbox (lstTeamNumbers), presented. On the userform, upon "clicking" the
cmdTeam control, I have the following:

lstTeamNumbers.Value = Range("bb1").Value
frmTeamQuery.Hide

After the code executes, there is no value populated in cell "bb1".

Any and All Help Will Be Appreciated


Jim Thomlinson[_5_]

List Box Value To Worksheet Cell
 
If I had a nickel for each time I have pondered the obvious for an eternity...
--
HTH...

Jim Thomlinson


"MWS" wrote:

Thank You Jim - WOW I Must Need A Break (LOL)

"Jim Thomlinson" wrote:

You are setting the value of the list box to whatever is in
Range("bb1").Value on the active sheet. If I understand you correctly you
want it the other way around...

Range("bb1").Value = lstTeamNumbers.Value
--
HTH...

Jim Thomlinson


"MWS" wrote:

Hello, Can someone tell me how I can take the value selected from a listbox
and place it in a particular worksheet cell?

Upon activating "Sheet4" in the file, I have a userform, which contains a
listbox (lstTeamNumbers), presented. On the userform, upon "clicking" the
cmdTeam control, I have the following:

lstTeamNumbers.Value = Range("bb1").Value
frmTeamQuery.Hide

After the code executes, there is no value populated in cell "bb1".

Any and All Help Will Be Appreciated


KD[_5_]

List Box Value To Worksheet Cell
 
Worksheets("blabla").Range("Target").Value = ListboxName.Text


Jim Thomlinson[_5_]

List Box Value To Worksheet Cell
 
I did not go that far as to specify the sheet only because the MWS indicated
that the form is shown based on the sheet activate event. Since I did not
specify the sheet name the active sheet (the one just activated) would be
used by default. That being said when in doubt it is better to be explicit as
you have in your code.
--
HTH...

Jim Thomlinson


"KD" wrote:

Worksheets("blabla").Range("Target").Value = ListboxName.Text




All times are GMT +1. The time now is 03:57 AM.

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