I am trying to declale a public array so I can use the dataset throughout the module for quite a few functions. At the moment I am creating the same array for each function and then iterating through the array to calculate the function, so rather than doing this many times I am trying to speed up the process by declaring a public array and using the 1 data set for all the functions.
So far my code looks like this, but it isnt working??? Any ideas??? The Sub fills the array and then the funcion calculates.
So far my code looks like this, but it isnt working??? Any ideas??? The Sub fills the array and then the funcion calculates.
Code:
Option Explicit
Public DataArray
Public MaxRows As Long
Sub FillArray()
Dim DataArray
Dim r As Range
Set r = Sheets("MyData").Range("Table1")
DataArray = r.Value
MaxRows = r.Rows.Count
End Sub