View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Debi H Debi H is offline
external usenet poster
 
Posts: 16
Default Looping thorough records

I have the following code that loops through the records and does fine but I
cannot get it to loop back through all of the records in column A. It looks
at cell A1 and does the loop and stops. What am I doing wrong?

Option Base 1
Public RelOpts() As String
Sub GetRelOpt()
x = 1
NextRow = 0
StrToMatch = Cells(1 + NextRow, 1).Value

ReDim RelOpts(1 To x)


Do While Cells(1 + NextRow, 1).Value < ""
If Cells(1 + NextRow, 1).Value = StrToMatch Then
RelOpts(x) = Cells(1 + NextRow, 2).Value
x = x + 1
ReDim Preserve RelOpts(x) As String
End If
NextRow = NextRow + 1
Loop
y = 1
Do Until RelOpts(y) = ""
CCString = CCString + RelOpts(y) + " ,"
y = y + 1
Loop
Cells(1, 5).Value = Left(CCString, (Len(CCString) - 2))


End Sub


Deb