View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Dana DeLouis[_3_] Dana DeLouis[_3_] is offline
external usenet poster
 
Posts: 690
Default faster way to do this?

On 1/12/2010 12:43 PM, Matt S wrote:
I have this code right now:

For ii = 1 to 100
arrayA(ii) = arrayB(ii) / 10^4
Next ii

Is there a way to do this calculation faster? Maybe without cycling thru
all elements of arrayA?

Thanks,
Matt


Maybe without cycling thru all elements of arrayA?


Here's one of a few ways to not "Loop," but it's probably not efficient.
I find it only helps when equations get too complicated.


Sub Demo()
Dim v
v = Array(30000, 50000, 70000, 110000, 130000)
v = Fx(v)
End Sub


Private Function Fx(v)
ActiveWorkbook.Names.Add "M", v
Fx = [M/10^4]
ActiveWorkbook.Names("M").Delete
End Function


= = = = = = =
HTH :)
Dana DeLouis