![]() |
Cell Value = to List Box Value Problem
Shawn, try the listindex property of the listbox if it is -1 no item is
selected: Private Sub cmbContinue_Click() if usfSiteSelection.lsbSelectSite.listindex = -1 then msgbox "Please select an item in the list box", vbokonly, "Selection..." else usfSiteSelection.lsbSelectSite.SetFocus ' I don't think you need this. Sheets("Daily Log").Range("C2").Value = _ usfSiteSelection.lsbSelectSite.Value end if -- Hope this helps Martin Fishlock Please do not forget to rate this reply. "Shawn" wrote: I have a listbox lsbSelectSite on useform usfSiteSelection. I also have a "Continue" Button. The list box list comes from a range of cells elsewhere in the file. When I click the continue button I want cell C2 in Sheet "Daily Log" to equal the value the user has scrolled to in the list box. My problem is the list box option has not been selected. Here is my code as it stands. The SetFocus is the prblem. Private Sub cmbContinue_Click() usfSiteSelection.lsbSelectSite.SetFocus Sheets("Daily Log").Range("C2").Value = usfSiteSelection.lsbSelectSite.Value End Sub -- Thanks Shawn |
All times are GMT +1. The time now is 02:07 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com