Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2007

Tip: Looking for answers? Try searching our database.

Calculation woes....

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Brad - 22 Jan 2007 22:52 GMT
My VBA code has a line where it populates an array with the results of an
array formula:

Selection.FormulaArray = MyFirstFormula

and, then another,

Selection.FormulaArray = MySecondFormula

My issue is that these steps are actually retrieving stock data from a
connected service, and sometimes the two arrays are populated almost
immediately, and at other times, it cogitates for a few seconds or even
longer. Well for those times when it isn't immediate, in the meantime my VBA
code drops down to execute the next line of code and attempts to calculate a
cell value based on inputs from the previously mentioned arrays which then
only may have #NA cell values.  The result is a run-time error since no data
has yet populated the arrays in these instances.

So, I have tried a few things like "application.wait," just to pass some
time to let the code execution steps pause until the arrays are given a
chance to populate before it executes the next line of code, but what it
seems to also do is stop the Selection.FormulaArray processes, so I gain no
edge there. The application.wait doesn't seem to just stop the forward
execution of code steps, it appears to stop the whole procedure.

Is there a coding solution back up at the Selection.FormulaArray lines where
I can force the program to not leap ahead until the arrays are populated?

My thanks in advance for any ideas on a direction here.

Brad
Don Guillett - 22 Jan 2007 22:56 GMT
You didn't post your code but I suggest you take a look in the vba help
index for
enableevents

application.enableevents=false
code
application.enableevents=true
Signature

Don Guillett
SalesAid Software
dguillett1@austin.rr.com

> My VBA code has a line where it populates an array with the results of an
> array formula:
[quoted text clipped - 28 lines]
>
> Brad
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.