Macro running in every workbook

  • I have a workbook opened which does some automatic calculations. However, when I open a new workbook unrelated to this original workbook, I keep getting an error:


    [ATTACH=CONFIG]70187[/ATTACH]


    when I debug it, it takes me to the VBA code where that original sheet is running.
    [ATTACH=CONFIG]70188[/ATTACH]


    What setting is making this code to run for every workbook I open?


    Thanks for the help!

  • Re: Macro running in every workbook


    I found a solution.


    I changed the code from this:



    to this:



    and it stopped trying to execute this code against every workbook I opened.

  • Re: Macro running in every workbook


    Something to remember - Bold tags do not work inside of Code Tags...


    A 'more correct' way of writing it would be to use

    Code
    Set wks = ThisWorkBook.Worksheets("Charts")


    That way the code can only ever refer to a worksheet in the current workbook, not the Active workbook and will continue to work after you change the filename (Some day, you will).

  • Re: Macro running in every workbook


    Quote from cytop;777450

    Something to remember - Bold tags do not work inside of Code Tags...


    I figured that out pretty quickly...:thumbup:


    Quote from cytop;777450

    ...after you change the filename (Some day, you will).


    L:razz:L! So true. Changes made.


    and THANKS!

Participate now!

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