Range Arguments

Range arguments in user-defined functions are only compatible with Extreme Speed when they are handled as Variant types. For example, for a function called on the worksheet as =MyFunc(A1:E4, 5, 4):

Function MyFunc (MyData As Variant, Rows As Long, Cols As Long) As Double 
	For I = 1 to Rows 
		For J = 1 to Cols
			MsgBox MyData(I, J) 'or otherwise work with the cell range as an array
		Next J 
	Next I
End Function