Hi
Something like this maybe:
If element = 1 then
Counter = Counter + 1
Else
end if
So if there is a 1 counter will increase by one and if there is a zero it wont.
Jacob
J.D.,
Not sure why you're using a 2D array for this.
If I understand correctly you want to have an array of up to 30 items and then you want to find the sum of n of the items.
Option Base 1 'Sets the array index to start at 1 instead of 0
Sub ArraySum()
Dim MyArry(30) as integer
'Read values into the array
For i = 1 to 30
MyArray(i) = Cells (i,1).value
Next i
n = InputBox ("How many items to sum?")
MySum = 0
'Sum n of the items in the array
For i = 1 to n
MySum = MySum + MyArray(i)
Next i
Cells (1,2).Value = MySum
End Sub
The above should illustrate the techniques for summing an array. If you have more questions, post back.
enjoy