View Single Post
 
Old 08-08-2014, 11:04 AM
CatMan CatMan is offline Windows 7 32bit Office 2010 32bit
Intermediate
 
Join Date: Apr 2012
Posts: 39
CatMan is on a distinguished road
Default

PROBLEM NOT SOLVED, SEE NEXT THREAD...

Hi Whatsup, Ok, I inserted your code suggestion using the "with" method and it worked for two and failed for one (Run-time error 381, Could not get the list property. Invalid property array index.) which makes perfect sense because as I look at the userform I can clearly see that one of the three listboxes has not set at all. So that means the problem is that I am not setting the listboxes robustly in the first place, which is why I cannot scrape out the listbox value and set the variable to it. The problem is not at the back end, it's at the front end. Her is how I am setting the variables now:

Code:
Uf_CertPlan_Owner.Tb_TotalQTY = Sheet18.Cells(C1, 2)
Uf_CertPlan_Owner.Lb_TeamPerformance = Sheet18.Cells(C1, 3)
Uf_CertPlan_Owner.Lb_ProgramPlan = Sheet18.Cells(C1, 4)
Uf_CertPlan_Owner.Lb_SowMaturity = Sheet18.Cells(C1, 5)

So using your suggestion to seek out another method of referencing the listbox I have appended ".value" to each of the code lines above and that worked pefectly. I will also rewrite this code to use the with method.

Many many thanks for helping me out of this hole. And I will heed you advice on not using reserved words for variable names.

Thanks again Whatsup. Here is the code that solved the problem:

Code:
With Uf_CertPlan_Owner
   With .Lb_TeamPerformance
       strS11 = .Value
   End With
   With .Lb_ProgramPlan
       strS12 = .Value
   End With
   With .Lb_SowMaturity
       strS13 = .Value
   End With
End With
Reply With Quote