A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

array data type



 
 
Thread Tools Display Modes
  #1  
Old June 15th, 2004, 03:38 PM
anjem
external usenet poster
 
Posts: n/a
Default array data type

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


---
Message posted from http://www.ExcelForum.com/

  #2  
Old June 15th, 2004, 05:17 PM
Alan Beban
external usenet poster
 
Posts: n/a
Default array data type

anjem wrote:
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


---
Message posted from http://www.ExcelForum.com/

Post the troubling code.

Alan Beban
  #3  
Old June 15th, 2004, 06:39 PM
anjem
external usenet poster
 
Posts: n/a
Default array data type

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


---
Message posted from http://www.ExcelForum.com/

  #4  
Old June 15th, 2004, 07:56 PM
Alan Beban
external usenet poster
 
Posts: n/a
Default array data type

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

anjem wrote:

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


---
Message posted from http://www.ExcelForum.com/

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:22 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.