View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default Calculation order

I just came across something interesting, and wonder if someone can point me to
a discussion.

I noted with regard to a UDF I have to convert Roman to Arabic numerals, that
the function call seems to affect the worksheet calculation order.

The original function call was:

Function Arabic (rg as range) as Long


With this call, given the following:

A1: some arabic number
A2: =ROMAN(A1)

A3: =Arabic(A2)

A3 appeared to calculate first. So that making a change in A1 would result in
A3 showing the number that was PREVIOUSLY in A1 instead of the current number.

Moving the cells around did not make a difference.

What did make a difference was eliminating the Type specification (or changing
the type specification to Variant) for the variable in the function call:

Function Arabic (rg) as Long

or

Function Arabic (rg as variant) as long

--ron