Combobox Issue

Burger01

New Member
Joined
May 29, 2002
Messages
49
I have this code as a part of a combobox:

Private Sub ComboBox4_change()
If ComboBox4.Value = "Up to 40 Years" Then
ComboBox3.Enabled = False
ComboBox3.Value = "N/A- Building is less than 40 years"
Label4.Enabled = False
Label18.Enabled = False
Else
ComboBox3.Enabled = True
Label4.Enabled = True
Label18.Enabled = True
End If
End Sub

WHat happens is that when "Up to 40 Years" is selected, it does what it is supposed to do by disabling combob 3 etc. But, it also loses the value selected, being "up to 40 years". Anyone know why it does this? ...and how I get around it?

Burger
This message was edited by Burger01 on 2002-09-03 16:58
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Nope, I don't see anything wrong about it. Have you tried putting a breakpoint at the beginning of that sub to see where does the ComboBox4 looses its value ?
 
Upvote 0
Tried Breaking every line and it seems straight away, as soon as selected, the value is lost in the combobox.

Got me stumped this one. The only way I can think to overcome it would be to put the value in a cell straight after selection.

Any more thoughts??? Or are there any other events which would work, apart from the combobox4_change?
This message was edited by Burger01 on 2002-09-03 18:32
 
Upvote 0
This seems strange.

How are you filling combo box 4? Are you aking cells from the Excel sheet or filling it through VBA code?

Cant really think what else is wrong. When you say it looses its value, how about other values in the combo box? Are other listed values still showing and accessable? Does the combo box still basically work properly with other values being shown but just the Up to 40 Years has disappeared?
 
Upvote 0
I select a value from the List (RowSource List). All the other values seem to stay when selected. I still haven't worked a way around it!

Maybe it is an anomoly on my system. I'm about ready to pack it in.
 
Upvote 0
Hi Burger01. Have you tried using the ListIndex values instead?
So for example if "Up to 40 Years" was ListIndex 0 and "N/A- Building is less than 40 years" was ListIndex 1 then you would put

If ComboBox4.ListIndex = 0 Then
ComboBox3.Enabled = False
ComboBox3.ListIndex = 1
 
Upvote 0
Parry,

Good information for me for next time, but it still doesn't work, it does the same thing.

Thanks though... any other ideas?
 
Upvote 0
I can't seem to find any fault in your code either. Here's a shot in the dark, but it has worked for me when such strange occurances happen. Try rebooting your computer. There is a chance there is a memory issue that is causing the problem. The only other thing I can think of to have you do is to insert a MsgBox at different parts of the code so you can get a real-time 'break' instead of using the F8 method.
 
Upvote 0
mmm I know its ComboBox4 thats the problem but I thought you would have had trouble altering the value of ComboBox3 when you have disabled it before changing the value.

instead of...
ComboBox3.Enabled = False
ComboBox3.Value = "N/A- Building is less than 40 years"

have...
ComboBox3.Value = "N/A- Building is less than 40 years"
ComboBox3.Enabled = False

I cant see why but just check it hasnt had any effect on ComboBox4.
 
Upvote 0
Tried it, but for some reason, that time it didn't even disable others.

... very frustrating. Maybe it is just a problem here somewhere.
 
Upvote 0

Forum statistics

Threads
1,214,405
Messages
6,119,320
Members
448,887
Latest member
AirOliver

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