View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Patrick[_14_] Patrick[_14_] is offline
external usenet poster
 
Posts: 14
Default Newbie repeat question

Hi,
so I want a parrt of my code to repeat until there is a line format found
on the cell which is already being searched for, my code is below. What am I
missing here?
My goal here is to format a seperation line on a page when the macro finds a
particular word in a column (the word is the end of each section of listing
for a sales person).
The code listed below does what I want but does not stop and continues
indefinately.
All help VERY much appreciated
Patrick


Sub Find2()
Do
Dim word As String
word = "ATM"
Cells.Find(What:=word, After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=False _
, SearchFormat:=False).Activate
ActiveCell.EntireRow.Select
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Cells.FindNext(After:=ActiveCell).Activate
Loop Until (LineStyle = xlContinuous)
End Sub