View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Cone Jim Cone is offline
external usenet poster
 
Posts: 3,290
Default Looping thorough records

Are you comparing Cell "A1" to the rest of the cells in column A or
are you looking for duplicates in column A ?
You could get a start on figuring out the problem by declaring all of your variables.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"Debi H"
wrote in message
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