0

I'm trying to run a macro every, time the selection of a dropdown menu in a cell changes. I've tried to follow this solution: automatically execute an Excel macro on a cell change

by entering the following code:

Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A1")) Is Nothing Then Call Testsub
End Sub

Public Sub Testsub()
MsgBox "Testmessage", , "Testbox"
End Sub

Cell A1 contains the Dropdown menu that should trigger the macro "Testsub". However, nothing happens when I change the selection. I'd be very grateful for any idea, what might cause the problem.

urdearboy
  • 14,439
  • 5
  • 28
  • 58
agermanguy
  • 93
  • 5
  • 2
    You probably put those in a public module code sheet. The Worksheet_Change belongs in the worksheet's code sheet (right click worksheet name tab, View Code). –  Mar 04 '19 at 14:20
  • You also do not need that call statement. Just `Is Nothing Then Testsub`. – urdearboy Mar 04 '19 at 14:25

1 Answers1

0

The comment of user11138753 nailed it. I edited the code at the wrong place.

Thank you very much!

agermanguy
  • 93
  • 5