+ Reply to Thread
Results 1 to 7 of 7

Runtime 1004 error

  1. #1
    Registered User
    Join Date
    07-23-2010
    Location
    nashvile, tn
    MS-Off Ver
    Excel 2003
    Posts
    12

    Runtime 1004 error

    Hello.. I am having a problem with a simple macro. I am wanting to have the macro go through my workbook and refresh 6 cells. After that it closes that worksheet and then opens up another one and does it all over again. Well that worked every now and then but ran into runtime 1004 errors... so I looked up and someone suggested saving and closing the workbook after every refresh.. then open back up and refresh... Well i am still having problems... any help would be appreciated.. Thanks..

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Runtime 1004 error

    meister14,

    Welcome to the Excel Forum.


    For all your Workbooks.Open statements, change this:
    Please Login or Register  to view this content.

    To this:
    Please Login or Register  to view this content.
    Have a great day,
    Stan

    Windows 10, Excel 2007, on a PC.

    If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  3. #3
    Registered User
    Join Date
    07-23-2010
    Location
    nashvile, tn
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Runtime 1004 error

    Thanks.. I did that but it works the same way as the past 2 versions... it gets through half the macro then gives me the 1004 error... It says something to the effect that there is no data from that url.. however there is data there (from yahoo financials) and it works sometimes and other times it gives the error... Should i have a pause in the macro or have the loop start back where the problem is? I have 4500 stock financial i want to update periodically and it will become a huge hassle if i keep getting errors like this .. Thanks again!

  4. #4
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Runtime 1004 error

    Please Login or Register  to view this content.
    But if you set each querytable's property 'RefreshOnFileOpen' to True then 1 line will do the same as your macro intended.

    Please Login or Register  to view this content.
    Last edited by snb; 07-24-2010 at 10:26 AM.

  5. #5
    Registered User
    Join Date
    07-23-2010
    Location
    nashvile, tn
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Runtime 1004 error

    Edit: oops i didnt see your edited part... let me try that..

    I tried that yet it only refreshes the first cell... 6 times i think... Maybe if i was more clear it would help.... I have 3 sheets in 1 workbook... the first sheet is called "Income Statement" A1 is the first cell that brings in the yearly income statement... A50 brings in the quarterly income statement...
    Then the 2nd sheet is called Balance Sheet... same as above .. a1 is yearly.. a70 is quarterly...
    The 3rd sheet is cash flow... a1 is yearly .. and a38 is quarterly...

    I want to have the macro go through and update each one. The problem is sometimes it goes all the way through the macro and sometimes it give me an error that says "Run-time error'1004':
    This web query returned no data. To modifty the query, click OK, click the name of the external data range in the name box on the formula bar, and then click edit query on the external data toolbar."

    It says it returned no data .. but there is data there and it returns it id say 30% of the time..

    Thanks again!

  6. #6
    Registered User
    Join Date
    07-23-2010
    Location
    nashvile, tn
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Runtime 1004 error

    I am an idiot... I could have saved so much time if I would have just changed that first macro that made the worksheets

    So before I go through a make a macro to change 4600 different worksheets to change to refresh on file open... IS there a high chance that I will still get this run-time 1004 error?

  7. #7
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Runtime 1004 error

    If no internet connection or when the server to which you link to is down, you will inevitably get errors. But you can try to intercept these with
    'on erro goto....'
    Last edited by snb; 08-03-2010 at 02:25 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