View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
dsi dsi is offline
external usenet poster
 
Posts: 6
Default loop replacement of multiple if-then's

I want to iterate throught the rows of a simple table, checking for the
value "P" in a specified column of each row, once I find "P" I want to
copy the row to a new workbook.

concatenating many (4) of the following together does exactly what I
need (except it won't handle the case of the engineers adding more than
5 similar parts)
If (Cells(c.Row, colPrimary).Value < "P") Then
Set c = Cells(c.Row + 1, c.Column)
End If

The following do while...loop structure doesn't do what I need and
breaks MsgBox statements that appear before the loop in the code.
Do Until (Cells(c.Row, colPrimary).Value = "P")
Set c = Cells(c.Row + 1, c.Column)
Loop

do you need more info?