Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-07-2014, 09:56 PM
CatMan CatMan is offline This is a Userform LIstbox queston:  A variable does not set to the value of a listbox Windows 7 32bit This is a Userform LIstbox queston:  A variable does not set to the value of a listbox Office 2010 32bit
Intermediate
This is a Userform LIstbox queston:  A variable does not set to the value of a listbox
 
Join Date: Apr 2012
Posts: 39
CatMan is on a distinguished road
Default 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
Reply With Quote
  #2  
Old 08-08-2014, 09:41 AM
whatsup whatsup is offline This is a Userform LIstbox queston:  A variable does not set to the value of a listbox Windows 7 64bit This is a Userform LIstbox queston:  A variable does not set to the value of a listbox Office 2010 32bit
Competent Performer
 
Join Date: May 2014
Posts: 137
whatsup will become famous soon enough
Default

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
 .
 .
Be aware:
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.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
This is a Userform LIstbox queston:  A variable does not set to the value of a listbox 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
This is a Userform LIstbox queston:  A variable does not set to the value of a listbox 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

Other Forums: Access Forums

All times are GMT -7. The time now is 12:49 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft