View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
RonaldF RonaldF is offline
external usenet poster
 
Posts: 16
Default Returning to last cell in a do until loop

This code looks for the value 7 in kolom A, when the value has been found he
copy it to kolom E.

"i" is de row to start and "m" is de row to start copy the values to

Sub test()
Dim i As Long, m As Long
m = 2
For i = 2 To Range("A1").CurrentRegion.Rows.Count
If Cells(i, 1).Value = 7 Then
Cells(m, 5).Value = Cells(i, 1)
m = m + 1
End If
Next
End Sub

--
Ronald Ferdinandus
http://www.ro-pay.nl


"Matilda" wrote:

Dear Undisguised Angels,
I am wanting to loop through a column looking for a value, then write that
value to another cell, then return to the column to continue the search to
the end. I can get to the target cell, but how can I return to the last
"true" cell before continuing the loop?

I'm trying a for....next loop but I'm afraid the syntax is eluding me.

Any help appreciated