+ Reply to Thread
Results 1 to 2 of 2

Code runs in debug mode only.

  1. #1
    Forum Contributor
    Join Date
    09-05-2011
    Location
    Essex, England
    MS-Off Ver
    Excel 2003 Excel 2007
    Posts
    383

    Code runs in debug mode only.

    Hi all,

    the code below runs fine in debug mode but stops at:
    Please Login or Register  to view this content.
    with error message Run-Time Error 91 Object Variable or with Block variable not set. When trying to run through in one go

    Please Login or Register  to view this content.
    any idea's what maybe causing this at all please?

    EDIT: it's ok solved the issue grr was an error in the TARGET_CELL.Offset(0, COLUMN_COUNT - 1).Value
    Last edited by Kramxel; 08-20-2015 at 10:34 AM. Reason: solved it

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,375

    Re: Code runs in debug mode only.

    Hi Kramxel,

    I've seen this when opening other files and it simply takes some OS time to perform the action. When you step through the code, there is time for the OS to do the work but when the code runs, lines of code fire before they are supposed to. To allow the OS time to do its work I've added some DoEvents code in my code which allows these other things to happen before trying to fire more lines of code. I use a lot of DoEvents when using SendKeys in my VBA code.

    All the above being said, I haven't examined your code fully to see where a DoEvents might be needed (if at all), but the question sounds like this answer might be correct.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

+ 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. Macro Runs IN Debug but Not In Automatic
    By SteWilf in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-14-2015, 02:41 AM
  2. VBA Code Runs in Debug Mode But Returns Type Mismatch Error Outside Debug Mode
    By valerie.k.chiang in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-24-2014, 03:48 PM
  3. [SOLVED] Code skips on Run Mode but runs fine on F8 (Debug Mode)
    By RaquelAR in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-25-2013, 01:05 PM
  4. Replies: 3
    Last Post: 03-29-2012, 01:58 PM
  5. VBA code only works correctly in Debug mode
    By tpthatsme in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-09-2012, 12:51 PM
  6. Macro Runs fine in debug but not from ComboBox
    By jaslake in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 02-25-2009, 10:17 AM
  7. [SOLVED] Excel 2000 Code works except in debug mode
    By Bob Smedley in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-23-2006, 09:25 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