'Run Time Error '380': Could not set the value property. Invalid value property'

Peter Thompson

Active Member
Joined
Dec 15, 2008
Messages
262
Hello,

I am currently developing a user form and am getting a very strange error message.

When it goes to retrieve data it gives me the message 'Run Time Error '380': Could not set the value property. Invalid value property'. When i hit the debug the following peiece of code is causing the issue:

'lst4Complexity = lngComplexity'

I cant understand what the problem could be as lngComplexity, in this instance, has a value of 5 and lst4Complexity is a listbox with options 1 to 5.

Has anyone had similar issues? Or can anyone suggest a solution?
 
Peter

A simple MATCH function is used to obtain the row of the complexity value in the range that populates the control.

That is 1-based, the 1st complexity value is in row 1, the 2nd is in row 2 and so on.

The items in the listbox have a 0-based index, the 1st item has index 0, the 2nd has index 1 and so on.

To select the item in the listbox we need it's index, so we subtract 1 from the row.

Hope that makes sense, if it doesn't post back - I'm not too good at explaining these things.:)
 
Upvote 0

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Norje,

Thanks for the suggestion. Ive tried it and it works. I was wondering if you could give an explanation as to how it works.

For example when I retrieve one record the value of complecity for that record is 5, which the code populates in the listbox, but I dont understand how it does this as when I step through the code lngindex = 5 and the -1 then takes it down to 4.

Thanks,

Peter

I had a similar issue with a userform that had worked fine for years and then started throwing up this error message. The dropdown list was populated with dates, the list range on the worksheet had been reformatted to show the year in four digits rather than two. Once reformatted all was well again.
 
Upvote 0

Forum statistics

Threads
1,224,525
Messages
6,179,319
Members
452,905
Latest member
deadwings

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