+ Reply to Thread
Results 1 to 5 of 5

Unwanted statements in macro

  1. #1
    Registered User
    Join Date
    06-05-2009
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2003
    Posts
    50

    Unwanted statements in macro

    Hi Forum Friends
    I created the driver macro Mike2 (At first cosisting only of the first 2 lines) with keyboard shortkey +m, to run macro Mike. (In future additionals macros)

    Every time I run this macro it adds 2 lines to the Macro
    ,regardless of the End and Exit sub statements.
    Why?? Do not want this to happen.

    Please Login or Register  to view this content.
    As always. Many thanks for any help.
    Al
    Last edited by aljanga; 11-28-2009 at 07:52 PM.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Unwanted statements in macro

    Hello aljanga,

    Why are you using End and Exit Sub in the macro?
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    06-05-2009
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2003
    Posts
    50

    Re: Unwanted statements in macro

    I was trying to stop the automatic addition of the 2 lines
    whenever I run the macro.
    Please Login or Register  to view this content.
    These lines were somehow generated by the macro!
    Hence the End and Exit sub statements. However,
    they did not stop the addition of statement lines.
    Al
    Last edited by Leith Ross; 11-28-2009 at 03:50 PM. Reason: Added Code Tags

  4. #4
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,601

    Re: Unwanted statements in macro

    Please explain more of what you are trying to do.
    1. Why write a macro to run another macro?
    2. What does the macro "Mike" do?
    3. Are these macros in the same or different workbooks?

    From what you said:
    I created the driver macro Mike2 ...to run macro Mike.
    It appears that the line:
    Please Login or Register  to view this content.
    is in Mike2 so that Mike2 is calling itself recursively with no exit point
    so you put in the END & EXIT SUB statements.
    Ben Van Johnson

  5. #5
    Registered User
    Join Date
    06-05-2009
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2003
    Posts
    50

    Re: Unwanted statements in macro

    Hi protonLeah
    Your statement about "recursively" made a light go on.
    I moved the code of Mike into Mike2 as you suggested and the macro
    now works fine.
    Mike is a macro that copies a series of formulas from P40:P54
    to any location in the worksheet where I need them. Do this often.
    Many thanks
    Al

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1