View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
[email protected] hanjohn@netspace.net.au is offline
external usenet poster
 
Posts: 17
Default VBA - Efficient Macro

Macros that work on the worksheet cells are slow.
You can greatly increase speed if you set up an array of the variant
type from you worksheet cells then use code that works with the array.
eg Dim MySheetArray as variant (in the declarations) then MySheetArray
= Range(A1:AZ2000) then code that works with the elements of this 2
dimensional array. mySheetArray(1,1) is the value in A1 on the
worksheet, mySheetArray(2,2) is the value in B2 on the worksheet etc.
One book I use suggests this results in code that runs up to 50 times
faster!
Ken Johnson