Forum Discussion

Peter621's avatar
Peter621
Copper Contributor
Sep 10, 2023

Problems with Macro window popping up unexpectedly

I am running excel under office 365 with Windows 10 Enterprise

 

I am trying to learn how to create a program that will run code automatically (without the use of a button) when a cell's value changes.  I found a tutorial on youtube ( https://www.youtube.com/watch?v=FgT0V4XyxEY ) that did this however when I follow completely I get different results. 

 

I have created an excel spreadsheet that has a form control button that toggles cell A1 between -1 and +1. The module should change cell C1 Red when it A1 is -1 and Green when A1 is 1.

 

When I come to run the code to test however I get a Macro window asking me which macro to run as shown below

I have already set the Macro settings in the trust centre correctly (I believe)

The file is saved in a trusted location - can anyone tell me what I'm doing wrong to get rid of this Macro window please?

 

Thanks in advance for any help

 

Peter 621

  • Patrick2788's avatar
    Patrick2788
    Silver Contributor

    Peter621

    If you're running the code with the play button in the VB editor, you have to stay within the sub when pressing play.

     

    The macro begins with:

    sub MacroName()

    and ends with:
    End Sub

     

Resources