+ Reply to Thread
Results 1 to 4 of 4

Code running multiple times. Need to run only once.

  1. #1
    Registered User
    Join Date
    08-20-2007
    Posts
    27

    Code running multiple times. Need to run only once.

    I have the following code which is intended to copy a column of cells and paste them up one position, triggered by a cell val. The problem is the code runs multiple times and performs the copy and paste multiple times. I have tried to insert a 1 second pause in the code to give time for the trigger cell to return to false, but it does not seem to work.

    Please Login or Register  to view this content.
    Last edited by tmkkoservo; 10-10-2014 at 09:38 AM.

  2. #2
    Registered User
    Join Date
    08-06-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: Code running multiple times. Need to run only once.

    You've got this set to run every time it calculates. When you update the cells using this code it will cause a calculation which means the code will be triggered again. Maybe using a different trigger would be better.

  3. #3
    Registered User
    Join Date
    08-20-2007
    Posts
    27

    Re: Code running multiple times. Need to run only once.

    The trigger cell is a link to an external data source. I have tried worksheet change a long time ago for this but I remember it seemed to only work if I typed a value into the trigger cell and pressed enter.

  4. #4
    Forum Contributor dlow's Avatar
    Join Date
    08-12-2013
    Location
    EveryWhere
    MS-Off Ver
    Excel 2007, 2010
    Posts
    275

    Re: Code running multiple times. Need to run only once.

    Yeah change the trigger & you could try putting
    Please Login or Register  to view this content.
    in your code where you want it to exit at. Or create a Test to check if the task needs to be done in the first place. Something like this
    Please Login or Register  to view this content.
    Last edited by dlow; 10-10-2014 at 09:48 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Running the same command multiple times
    By mej in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-11-2013, 12:03 AM
  2. Macro for running the SQL code multiple times
    By sawoodalam1989 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-27-2013, 08:35 PM
  3. Macro for running the SQL multiple times
    By sawoodalam1989 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-27-2013, 07:00 AM
  4. help fixing my macro from running multiple times
    By MurseBry in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-19-2010, 02:17 AM
  5. running loop multiple times?
    By mister tom in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-26-2010, 01:43 PM

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