PC Review


Reply
Thread Tools Rate Thread

Calculation woes....

 
 
Brad
Guest
Posts: n/a
 
      22nd Jan 2007
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



 
Reply With Quote
 
 
 
 
Don Guillett
Guest
Posts: n/a
 
      22nd Jan 2007

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
--
Don Guillett
SalesAid Software
(E-Mail Removed)
"Brad" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculation woes =?Utf-8?B?SlA2MjYyQU1Z?= Microsoft Access Reports 1 5th Feb 2006 04:40 AM
Calculation woes =?Utf-8?B?SlA2MjYyQU1Z?= Microsoft Access Forms 3 4th Feb 2006 08:08 PM
How do I use a rounded calculation result in another calculation? =?Utf-8?B?dm5zcm9kMjAwMA==?= Microsoft Excel Worksheet Functions 1 26th Jan 2005 10:11 PM
Concatenating a Calculation with Text causes the Calculation to be incorrect?? Nelson Microsoft Excel Worksheet Functions 4 1st Apr 2004 06:51 PM
range.calculation with UDF not working when calculation is set to automatic Brian Murphy Microsoft Excel Programming 5 14th Oct 2003 07:02 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:49 PM.