+ Reply to Thread
Results 1 to 3 of 3

Macro run fails, step through works.

  1. #1
    Registered User
    Join Date
    06-15-2009
    Location
    Canberra, Australia
    MS-Off Ver
    Excel 2007
    Posts
    2

    Macro run fails, step through works.

    Hi.

    This is weird. I have a macro that I recorded from the keyboard and mouse.

    Basically the macro is activated by a button and pastes a single column of text into F:F of sheet one, copies it to A:A of sheet two where four blank lines are inserted between each cell and then copies the column back to column G:G of sheet one.

    When I step through (F8) it works perfectly, however using the button causes the macro to miss the first two of the four line insertions. This then puts the cells in the wrong place when the column is pasted into it's final position in sheet one.

    Has anyone seen this sort of behaviour before?

    And any ideas what's going wrong? I'm using Excel 2007.

    Here's the code:
    Please Login or Register  to view this content.
    Thanks

    Steve.
    Last edited by Leith Ross; 06-15-2009 at 11:17 PM. Reason: Added Code Tags

  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: Macro run fails, step through works.

    Hello SteveAlston,

    Welocme to the Forum!

    To make your posts easier to read, copy, and edit please wrap your code. I did it for you this time. Here is how you can do it next time.

    How to wrap your Code
    1. Select all your code using the mouse.
    2. Click on the # icon on the toolbar in the Message window. This will automatically wrap the text you selected with the proper Code tags to create a Code Window in your post.

    3. You can also do this manually by placing the tags
    [code]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/code] at the end of the line.
    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-15-2009
    Location
    Canberra, Australia
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Macro run fails, step through works.

    Thanks Leith, I'll learn as I go I guess!

    I've attached the whole Excel file. It may explain things easier.

    Or not. |-)

    Steve
    Attached Files Attached Files
    Last edited by SteveAlston; 06-15-2009 at 11:40 PM.

+ 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