Recalc Issue

  • Thread starter Thread starter Alan
  • Start date Start date
A

Alan

I have a custom function in my application and need this to calculate when
running a macro from within the custom application. Eg. I have a function
called "CalculateCell" in cell A1 and need to have this calculate in Excel
while running the custom function "FunctionTest". The problem with this is
that when you use Application.Range("A1").Calculate you get an error and I
think it is the fact that you cannot Calculate in Excel when a custom
function is running. Is there any way around this. I need to calculate this
through Excel and not direct through the custom application such as can do.
There are parameters in Excel that need to be picked up.

Any help would be appreciated.
 
This will not work for me as I do not want any other cells to calculate.

Thanks for the response
 
Hi
you can only restrict the re-claculation on a individual
sheet. But to be hionest I really don't know for what you
need the re-calculation of a single cell. Maybe you can
explain your used functions a little bit more
 
I put some test data in A1:A10 and a udf in B1:B10 (pointing at column A of that
same row).

Then if I had calculation set to manual, it seemed to calculate just that cell's
UDF.

Sub testme()
'just to insure calculation is manual.
Application.Calculation = xlCalculationManual
With Application.Range("b1")
.Formula = .Formula
End With
End Sub

But with calculation set for automatic, this sub (w/o the calculation line)
caused an =rand() to recalc.

And if I used:
activesheet.range("b1").calculate

With calculation automatic, the other cells with UDF's were recalculated.

With calculation set for manual, it appeared to work ok. (Just that cell was
recalculated.)

I used activesheet to be more specific (than application).
 
Back
Top