STOCKHISTORY: Is "#BUSY!" a real error

mookyon

New Member
Joined
Dec 23, 2021
Messages
35
Office Version
  1. 365
Platform
  1. Windows
Dear Members,

I am using STOCKHISTORY function and VBA (on 365).

When STOCKHISTORY function is operational, Excel shows #BUSY! “error like” message where results should appear later when retrieval is done.

This is an Error-Like message since it is never reflected neither in IFERROR, nor in functions (e.g., ISERROR, or ERROR.TYPE).

While retrieval is active (and #BUSY! is shown on cells) VBA stops. I found no way to check whether the target cell had finished displaying #BUSY! and now displays the required stock price.

Do you think asynchronous processing will work here?

If anyone had resolved this issue, please kindly advise.

1000 THX
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
I think you can check if the cell value returns an error or not by using the IsError function.

VBA Code:
If IsError(TargetCell) then
' Error
end if

However, I believe you'll need to use a loop to continue VBA execution after waiting #BUSY! returns to a value OR another error perhaps.
Maybe something like this (I am not familiar with the STOCKHISTORY function, so you can test with your formula instead):

VBA Code:
Sub doIt()
    Range("A1").Formula = "=STOCKHISTORY(""MSFT"", TODAY())"
   
    Do While CStr(Range("A1")) = "Error 2051" ' #BUSY! error value
        DoEvents
        Debug.Print "Still BUSY!"
    Loop
    Debug.Print "Not BUSY anymore"
End Sub
 
Last edited:
Upvote 0
Thank you very much smozgur,

I checked both options, but none worked.

While STOCKHISTORY displays #BUSY!, IsError (VBA function) will be true. However as long as VBA is running #BUSY! will not change. You’ll need to stop VBA in order to finish #BUSY!

Same applies to checking CStr(Range("A1")) = "Error 2051"
(and Debug.Print "Still BUSY!" will become an endless loop)

I am still looking for a working solution…
 
Upvote 0
I actually posted the second code that works as it is expected to demonstrate how it works when VBA is working. This is what I get on my computer:

1667820277975.png


However, it really depends on your code. Perhaps it is somehow blocking auto-calculation. For me, it is hard to say something without seeing the entire process.
 
Upvote 0
Dear [FONT=arial]smozgur[/FONT],

THX again. I don't know why but, my system keeps printing "Still Busy" endlessly. Never shows "Not BUSY Anymore".

The formula shows #BUSY! until I click the Reset (square) button on the VBA screen. Then immediately the result is properly displayed in A1.

I wonder why we see different results.
(I use Microsoft® Excel® for Microsoft 365 MSO (Version 2210 Build 16.0.15726.20188) 64-bit)
 
Upvote 0
Not sure if your issue is resolved. I faced exact same issue and tried above solution. What I see is whenever #BUSY! is triggered, the calculation stops running in the Do While loop. I finally turned on "Enable iterative calculation" in the options page and it works fine. Hope this helps
 
Upvote 0

Forum statistics

Threads
1,214,627
Messages
6,120,610
Members
448,973
Latest member
ChristineC

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top