|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
This is a Userform LIstbox queston: A variable does not set to the value of a listbox
Moved to Excel VBA forum...
Last edited by CatMan; 08-08-2014 at 08:50 AM. Reason: MOVED to EXCEL VBA FORUM: the excel attachment does not appear to have downloaded |
#2
|
|||
|
|||
Hi CatMan
Hm, quick and dirty you can obtain the value from the Listindex: Code:
. . Dim strS11 As String, strS12 As String, strS13 As String 'strS11 = Uf_CertPlan_Owner.Lb_TeamPerformance.Value 'strS12 = Uf_CertPlan_Owner.Lb_ProgramPlan.Value 'strS13 = Uf_CertPlan_Owner.Lb_SowMaturity.Value With Uf_CertPlan_Owner With .Lb_TeamPerformance strS11 = .List(.ListIndex, 0) End With With .Lb_ProgramPlan strS12 = .List(.ListIndex, 0) End With With .Lb_SowMaturity strS13 = .List(.ListIndex, 0) End With End With . . It's not a proper solution, since it doesn't solve the problem at the root. It's just another way to obtain the desired data. Where the problem comes from is difficult to say, you are using to many shortcuts in your script, e.g. there is no refering to a explicit property of a control, instead you merely refer to the default property which makes it difficult to read your code. Your project seems too advanced to work it over completely so I won't say too much about it. But one thing I recommend strongly to change: Never use names for variables (neither for functions or subs) which are already in use by excel itself. For instance: S11 refers to the cell "S11", is therefore in use of excel, and such things cause problems all the time. If the particular problem is a result of this or something else I can't say, but it's the first thing you will have to change, otherwise you never will be sure if your scripts will work correctly. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Moving Selected Items from a Multiselect Listbox on a userform to a bookmark in Word | marksm33 | Word VBA | 3 | 01-15-2015 07:55 PM |
Checkboxes are unchecked in Listbox that were checked off before.How can I stop this? | Rochelle711 | Excel Programming | 0 | 06-22-2014 06:16 PM |
Is there a way to Hightlight the item in a ListBox when the mouse hovers over it? | saltlakebuffalo | Excel | 0 | 04-21-2014 10:00 AM |
Multi-select listbox help | gvibe@hotmail.com | Word VBA | 1 | 07-19-2013 10:54 AM |
as the return value of another column, using Listbox? | marreco | Excel Programming | 1 | 03-27-2012 12:48 PM |