Thread: Array Pointer
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Mike H. Mike H. is offline
external usenet poster
 
Posts: 471
Default Array Pointer

Here is what I do. I read into Dataarray() all my entries in a spreadsheet
(about 5000). The array is like this: Dataarray(REC#,1)=Account #
DataArray(Rec#,2)=Account description if there is one (if it is a valid
account). To fill in the second element I do this:



Windows("Chart of Accounts.xls").Activate
Sheets("Entire Chart").Select
Let Counterx = 0
For YY = 1 To X
Let XX = 0
Set myRange = Range("A1:A65000")
flag = 0
For Each c In myRange
Let XX = XX + 1
If c.Value = DataArray(YY, 1) Then flag = 1
If flag = 1 Then
Exit For
End If
Next
If flag = 1 Then
DataArray(YY, 2) = Cells(XX, 2)
Else
Let Counterx = Counterx + 1
BadAccts(Counterx, 1) = DataArray(YY, 1)
'MsgBox ("Account " & DataArray(YY, 1) & " is not in the chart of
accounts!")
End If
Next

This code takes about 45 minutes to go through 5000 records. Any
suggestions would be welcomed.