In excel i have various cells that have a drop down e.g. A29, C29, and i want to run a different set of macros depending on the range,

Brian Vagg 0 Reputation points
2025-10-24T01:27:29.8966667+00:00

In excel i have various cells that have a drop down e.g. A29, C29, E29, G29, I29, A31, C31, E31 G31, I31 etc and i want to run a different set of macros depending on the range,For A29 it is one particular type, C29 a different set of types

In the below how do I add if the target is If Target.Address = "$A$29", and E29 and I 29 and so on

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address = "$C$29" Then

    Select Case Target.Value

        Case "16.4 Grasim"

            Call Grasim_164

        Case "16.9 Grasim"

            Call Grasim_169

        Case Else

            MsgBox "No macro defined for: " & Target.Value, vbExclamation

    End Select

 On Error Resume Next

    Application.Run Target.Value

    On Error GoTo 0

End If
```End Select

```vba
 On Error Resume Next

    Application.Run Target.Value

    On Error GoTo 0

End If
```End Sub
Microsoft 365 and Office | Excel | For home | Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Thomas4-N 2,660 Reputation points Microsoft External Staff Moderator
    2025-10-24T09:20:29.51+00:00

    Hello Brian Vagg, welcome to Microsoft Q&A forum.

    I understand you want to run macros when specific dropdown cells change without repeating multiple If Target.Address = ... checks. You can simplify your code by using the Intersect method to check if the changed cell is in your allowed list.

    Private Sub Worksheet_Change(ByVal Target As Range)
        If Target.CountLarge > 1 Then Exit Sub
        ' One check for all allowed cells
        If Intersect(Target, Range("A29,C29,E29,G29,I29,A31,C31,E31,G31,I31")) Is Nothing Then Exit Sub
        Application.EnableEvents = False
        Select Case Target.Value
    .....
    

    Let me know if you have any further questions. Warm regards,


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".  

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.  


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.