August 23, 2018

Worksheet Change Event to Run a Macro

How to run a macro on worksheet change event like a change in selection in a drop-down list created using data validation. First we create a drop-down list using data validation. Now when we select a name from the drop-down list a macro is executed because we linked the target cell address with the macro. Watch the video and then study the VBA code:

Watch this video on YouTube.

Here’s the complete VBA code:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = “$A$2” Then

Select Case Target.Value

Case “Harry”
Call Harry

Case “Dinesh”
Call Dinesh

Case “Rajan”
Call Rajan

Case “Laura”
Call Laura

Case “Faizal”
Call Faizal

End Select

End If
End Sub

The Target is the Range ($A$2) which has the data of names in a drop-down list. As soon as the user selects a name it triggers an action, i. e. fires up the relevant macro,

Further reading:

Worksheet Change


4 thoughts on “Worksheet Change Event to Run a Macro

  1. Dear sir
    This is sachin shinde from mumbai.
    Your excel cha codes are very useful and it helping me a lot.specially i liked your video on emails sending via gmail using excel vba.
    Thank u very much
    Waiting for your new videos….

  2. Hi Dinesh,

    Its interesting but in my application i need to club the SendReminderMail VB code. Here i am utilizing only the reminder mail but not the other two sections mentioned in the tutorial. Now i need to run the macro “SendRemainderMail” automatically after selecting the Send Remainder in the worksheet created as the drop down list for my ease. I tried to use the VB codes and reminder codes but it didn’t work..!! Can you please help me out

Comments are closed.