Thread: loop
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default loop

Hi,

Try this

Sub nn()
Dim LastRow As Long
Dim MyRange As Range
LastRow = Cells(Cells.Rows.Count, "F").End(xlUp).Row
Set MyRange = Range("F1:F" & LastRow)
For Each c In MyRange
If UCase(c.Value) = "VENDOR ID" Then c.ClearContents
Next
End Sub
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Christina" wrote:

Actually I would need it to Exit when there are no more cells with "Vendor ID"

Do

Range("F:F").Find(What:="Vendor ID", After:=ActiveCell,
LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlDown, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Select
ActiveCell.ClearContents
ActiveCell.Offset(1, 0).Select

Selection.Copy
Range(Selection, Selection.End(xlDown)).Select
ActiveSheet.Paste

Loop


Thanks


"Mike H" wrote:

Christina,

Post your loop and someone will help
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Christina" wrote:

I need help with a loop. After looping through the procedure, when the
active cell is empty I want to exit the loop. Would you please give me the
codes to do that.


Thanks


Cristina