Run Individual Macros Based On Validation List Selection

  • Hello, Everyone.


    I have been searching through the site trying to find a solution to my issue, but I just can't seen to fixt it. Here is the scenario.


    I am working on a spreadsheet that will read some data, use that data to update the main chart and fill in the information in a table next to that chart.


    I recoreded 22 macros, total. Each macro corresponds to the especific type of chart that I need/want.


    I want to be able to click on a drop down menu above the chart which will have each of the 22 options. Once the user clicks on the desired option, the specific macro will run and do that it should do.


    When I run the individual macro (without the VB that I wrote and will mention below), the system does what it should do. Everything looks dandy.


    But then I added this VB code to the sheet where the chart is:



    So this code is telling excel to read the returned value of cell "A12" and use it to do the especified cases.


    When i go to the dropdown menu, it does something really quick... and then it goes on something that looks like an infinite loop. It changes back and forth and i can't stop it. I then hit ESC on my keyboard and it tells me to end or debug.


    Also, when i try to run the individual macros when the VB code is in there, it does the same. Then if i remove the code and try running the macro again, it works just fine.


    I have tried several things but can't seem to fix this.


    I know that what I want to do is possible... i just can't seem to find the way to do it.


    PLEASE HELP!


    I need to complete this report ASAP.


    I would attach a sample but my file is about 800 kb... way over the allowed limit. However, if you would like a copy of the file, please private message me and I'll share the file with you via email or something.


    Any suggestions will be great.


    Thank you!


    Alpineclimbingrules

  • Re: Run Indivudual Macros Depending On Validation List Selection


    Change


    Code
    Select Case Target.Range("A12").Value


    to

    Code
    Select Case Range("A12").Value


    also add at the start

    Code
    Application.EnableEvents = False


    and turn on at the end

    Quote

    Application.EnableEvents = True


    VBA Noob

  • Re: Run Indivudual Macros Depending On Validation List Selection


    Do the macros being called change the worksheet? If they do, then what is likely happening is everytime the code changes something on the worksheet, the Worksheet_Change event is called...which then calls the macro again....which then changes the worksheet....creating a never ending loop.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!