Running Macro based on selection from Combo Box

mtampa

Board Regular
Joined
Oct 15, 2007
Messages
61
I think I may have posted this twice as my Internet Explorer is acting weird....I apologize if it is indeed a double-post.
==================================================
Hi all,

I have a combo box on a form which has 4 selections. When selection 3 is chosen and the number 3 outputs to it's linked cell, I want a macro to trigger. I have been able to build my macro and it functions correctly when I run it manually, but I cannot get it to fire when the selection is made off the combo box.

However, I am able to simply type the number 3 in the box and hit enter and the macro will run perfectly.

When the form is opened, the combo box selection defaults to choice 1. The VBA I am using is below:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Address = "$K$3" Then
Select Case Target.Value
Case Is = 3: Call EMPVILL
Case Else: 'Do Nothing
End Select
End If
End Sub

I was hoping someone could shed some light on what I am doing wrong, or if it is simply something that a combo box cannot accomodate.
 

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.
If it's a ComboBox from the Control Toolbox right click and choose View Code. If it's from the Forms Toolbar right click and choose Assign Macro.
 
Upvote 0

Forum statistics

Threads
1,224,602
Messages
6,179,844
Members
452,948
Latest member
UsmanAli786

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