Edit Combo Box code

RAM

Well-known Member
Joined
Oct 4, 2004
Messages
1,862
Hi guys,

I have a Combo Box with the following code:

Private Sub ComboBox1_Click()
'LinkedCell in ToolBox Properties must be unmarked
ActiveSheet.Unprotect
With ComboBox1
If .ListIndex = -1 Then Exit Sub
Range("ac7").Value = IIf(.ListIndex = 0, 1, .Value)
End With
ActiveSheet.Protect
End Sub

After each time I change the value in the drop down the icon for E-mail in the toolbar is grayed out, and I have to click in any part of the sheet to activate the icon again.

What about if we add a “refresh” or “activate” or something to the code for each time I select and that added code has the same effect as when I click on the sheet to activate the E-Mail icon.

Thanks in advance,

RAM
 

Some videos you may like

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

dk

MrExcel MVP
Joined
Feb 15, 2002
Messages
2,942
Hi

You can just select a cell within your code to take the focus from the combobox to the sheet e.g.

Code:
Private Sub ComboBox1_Click()
'LinkedCell in ToolBox Properties must be unmarked
ActiveSheet.Unprotect
With ComboBox1
If .ListIndex = -1 Then Exit Sub
Range("ac7").Value = IIf(.ListIndex = 0, 1, .Value)
End With
ActiveSheet.Protect

Range("F9").Select
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,122,521
Messages
5,596,650
Members
414,083
Latest member
Mrsash

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
Top