James123456
New Member
- Joined
- Jan 6, 2012
- Messages
- 18
Can anyone please help me with an array. I am trying to find a particular position containing a value e.g. 10, 20, 40 etc...then take the 5 values above and 5 values below including the value I am searching for and do an average of it, thus doing an average of 11 values. So far I have managed to store the range in the array using:
Haven't had any luck going forward Any help with this so much appreciated. Thank you.
Code:
Public Sub myArray()
Dim myArr() As Variant
Dim R As Long
Dim C As Long
myArr = Range("C6:D1126")
For R = 1 To UBound(myArr, 1)
For C = 1 To UBound(myArr, 2)
Debug.Print myArr(R, C)
Next C
Next R
End Sub