Listbox selection

fmascioni

New Member
Joined
Aug 11, 2008
Messages
46
Hello,

Is there a way to select a userform listbox item based on the string in a cell? The listbox will already contain the item. I tried the following:

'update userform
Me.xMachineTypeListBox.Selected = CStr(wsFPY.Cells.Range("C" & contractLocation.Row).Value)

I found quite a few posts regarding populating a listbox but didn't find any regarding selecting an item that is already in the listbox.

Any suggestions greatly appreciated.
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
OK either I'm trying to do something non-standard or my question is not clear....

Maybe there is a better way altogether. The application is that a user enters data into a spreadsheet via a userform. He needs capability to re-populate the same userform later with the data from the spreadsheet. Textboxes are easy to populate with cell values but what do you do with the listboxes?
 
Last edited:
Upvote 0
OK, I finally got it. I just had the syntax wrong. The following worked just fine:


Me.xMachineTypeListBox.Value = CStr(wsFPY.Cells.Range("C" & contractLocation.Row).Value)
 
Upvote 0

Forum statistics

Threads
1,213,513
Messages
6,114,072
Members
448,546
Latest member
KH Consulting

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top