Combobox not working after being modified by a macro

S Oberlander

Board Regular
Joined
Nov 25, 2020
Messages
153
Office Version
  1. 365
Platform
  1. Windows
I have an excel sheet with a combobox and checkbox
the checkbox is set to invoke the combobox and vice versa

somehow after the checkbox is clicked and the combobox value changes thru vba, the combobox stops working
if I click on the combobox, instead of giving me the dropdown selection, the image of the combox momentarily appears duplicated right next to it

see code below, is there any way to fix this?

VBA Code:
Private Sub iqmpchck_Click()
If iqmpchck.Value = False Then
 ComboBox1.Value = "OFF"
Else
 ComboBox1.Value = "Sample"
End If
End Sub

Private Sub ComboBox1_Change()

Dim newval As Range
Set newval = Sheets("Sheet2").Range("B1")

Select Case ComboBox1.Value
Case "Sample"
'things happen
Case "example "
 'things happen
End Select

If newval = "OFF" Then
    iqmpchck.Value = False
End If
End Sub
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
I duplicated your controls and code. No issues. Do you have any other controls on that sheet? Do you have any hidden objects on that sheet? (Home > Find & Select > Selection Pane)
 
Upvote 0
I put my workbook into design mode, moved the combox to a different place on the sheet and now its working properly.
Do I just chalk this up to one of excel's unexplainable errors?
 
Upvote 0
It is still a strong possibility that you had two controls in the same space. If not so, then yes (cue the X files theme song)
 
Upvote 0
Solution

Forum statistics

Threads
1,223,887
Messages
6,175,199
Members
452,617
Latest member
Narendra Babu D

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