Can any one kindly check the code, I explained the code in comments.
I am getting run error 13
My concern in the assign method that I am using. I want to assign the cell value in the array starting form position 0
Thank you very mush
Sub zones()
Dim Top10zones(0 To 9) As Long
Dim found As Boolean
Top10zones(0) = 309101502
NumRows = Range("A1", Range("A1").End(xlDown)).Rows.count
Dim Arry As Variant
Dim count As Integer
count = 0
' find the 10zones in row 1.
Range("A1").Select
Do Until IsEmpty(ActiveCell)
If ActiveCell.Value = Top10zones(0) Then
found = True
Exit Do
End If
ActiveCell.Offset(0, 1).Select
Loop
' if found move to row 2 in the same cloumn.
If found = True Then
ActiveCell.Offset(1, 0).Select
For j = 2 To NumRows
If ActiveCell.Value <= 1 Then
' if the value <= 1 assign cells(j,1) to the array.
Arry(count) = Cells(j, 1).Value
count = count + 1
End If
ActiveCell.Offset(1, 0).Select
' repeat the process.
Next j
End If
End Sub