array data type

A

anjem

Hi, I'm trying to take a column of integers and input them into an arra
which I can then use for a loop instead of using this format:
If (Worksheets("NeeleyNedPRE").Cells(pRow, pCol).Value = 0) Then

For some reason this doesn't work because the column selected al
resets to zero rather than running the loop correctly and I think tha
an arrray might be the only option. What the easiest way to solve thi
problem?
-Andre
 
A

Alan Beban

anjem said:
Hi, I'm trying to take a column of integers and input them into an array
which I can then use for a loop instead of using this format:
If (Worksheets("NeeleyNedPRE").Cells(pRow, pCol).Value = 0) Then

For some reason this doesn't work because the column selected all
resets to zero rather than running the loop correctly and I think that
an arrray might be the only option. What the easiest way to solve this
problem?
-Andrew
Post the troubling code.

Alan Beban
 
A

anjem

Dim xDataArray(10940) As Integer
Dim rowCount As Integer
For rowCount = 21 To 10940
Worksheets("NeeleyNedPRE").Range("I" & rowCount).Value =
xDataArray(rowCount)
Next rowCount
Dim Check As Boolean
Check = True
Dim xArray(10940) As Integer
Dim xCount As Integer
xCount = 0
Dim pRow, pCol As Integer
pRow = 21
pCol = 12
Do
Do While i < 10920
If (Worksheets("NeeleyNedPRE").Range("L" & pCol).Value = 0)
Then
xCount = xCount + 1
pRow = pRow + 1
i = i + 1
xArray(i) = xCount
Else
pRow = 0
pCol = pRow + 1
i = i + 1
xArray(i) = xCount
End If
Loop
Check = False
Loop Until Check = False
 
A

Alan Beban

After Dim xDataArray(10940) As Integer, xDataArray is a one-dimensional
array with all elements equal to 0. What are you expecting
Worksheets("NeeleyNedPRE").Range("I" & rowCount).Value =
xDataArray(rowCount)

to do? (It is simply setting all the values in I21:I10940 to 0.)

Alan Beban
 
Top