+ Reply to Thread
Results 1 to 4 of 4

vba code throws an error first time but runs perfectly the second time. HELP!!

  1. #1
    Registered User
    Join Date
    02-24-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    76

    Unhappy vba code throws an error first time but runs perfectly the second time. HELP!!

    Hi,

    I have written a vba script that automate the generation of reports. The script works fine as a whole. But I found out that Once I make any changes in the excel file like deleting an empty row or inserting an empty row -- which is not related to my calculation), the vba throws an error that displays the dialog box with nothing printed on it(i have attached the image of it). But When I execute it once again for debugging, it works fine. I am not sure where did I make the mistake.

    Thanks.
    Attached Images Attached Images

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: vba code throws an error first time but runs perfectly the second time. HELP!!

    Would help if you post the code! Although it looks like it could be an excel bug rather than something in your code. There might be suggestions here that help you (although they seem 2007 specific - what version are you using?):
    http://www.excelforum.com/excel-prog...ssage-box.html

  3. #3
    Registered User
    Join Date
    02-24-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    76

    Re: vba code throws an error first time but runs perfectly the second time. HELP!!

    Hi. thanks for the reply. I am using Excel 2010. here is the code.
    Please Login or Register  to view this content.
    I am not sure what is going wrong here.

  4. #4
    Registered User
    Join Date
    02-24-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    76

    Re: vba code throws an error first time but runs perfectly the second time. HELP!!

    Now I made some changes (like inserting, deleting the empty rows) and i executed the script and it works now.

+ 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. Replies: 6
    Last Post: 03-01-2014, 02:52 PM
  2. [SOLVED] On error runs for first time only
    By navwelch in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-19-2013, 06:54 AM
  3. [SOLVED] Copying a user input code into a macro each time it runs
    By Mogpot1 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-18-2013, 10:12 AM
  4. Error when running macro at a specific time: only runs once
    By Axildoofay in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-09-2013, 05:54 AM
  5. Run-time Error 9 with Excel macro - Runs in 2003, Fails in 2007
    By jialant in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-05-2008, 09:37 AM

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