Loop

C

Christina

Sorry I have to post a new thread. I have not been able to do it the way I've
been told.
I dont know VBA or programming. I make macro by recording steps.
I have this macro which ends with a loop as below. It works, but I need it
to End when there are no more cells with VENDOR ID.
It does the step but ends with the dialog box and I have to click end.

Grateful for help


Do
 
D

Dave Peterson

Did you try all the suggestions at your other thread--or one of your other
threads?
 
J

Jim Thomlinson

This should be close...

Dim rngFound As Range
Dim strFirst As Range
Dim rngToSearch As Range

Set rngToSearch = Range("F:F")
Set rngFound = rngToSearch.Find(what:="Vendor ID", _
LookAt:=xlWhole, _
LookIn:=xlFormulas, _
MatchCase:=False)
If rngFound Is Nothing Then
MsgBox "Nothing Found"
Else
strFirst = rngFound.Address
Do
With rngFound
.ClearContents
.Offset(1, 0).Copy Destination:=Range(.Offset(1, 0), _
.Offset(1, 0).End(xlDown))
End With
Set rngFound = rngToSearch.FindNext(rngFound)
Loop Until rngFound.Address = strFirst
End If
 
C

Christina

Thanks, seema I overlooked that one. It worked perfectly. Thanks a lot.

Regards.
Cristina Seawell
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top