Running Macro based on selection from Combo Box

mtampa

Board Regular
Joined
Oct 15, 2007
Messages
61
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

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
YOu can try...
Code:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Select Case Range("K3")
Case 3: Call EMPVILL
Case Else: 'Do Nothing
End Select
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,582
Messages
6,179,670
Members
452,936
Latest member
anamikabhargaw

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