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

I am getting a runtime error on the format part of the code?
Any ideas? I pasted the modified code below which applies to my sheet.
Thanks
Patrick

Sub Myfind()
Dim rng As Range
Dim result As Range
Dim firstAddress As String

Set rng = ThisWorkbook.Worksheets("Analyzer_Patrick's Monthly
Repo").Range("A:F")

With rng
Set result = .Find("ATM", After:=ActiveCell, LookIn:=xlFormulas,
LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=False _
, SearchFormat:=False)

If Not result Is Nothing Then
firstAddress = result.Address
Do
With result.EntireRow
With .Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
.Borders(xlEdgeBottom).LineStyle = xlNone
.Borders(xlEdgeRight).LineStyle = xlNone
.Borders(xlInsideVertical).LineStyle = xlNone
End With
Set result = .FindNext(result)
Loop While Not result Is Nothing And result.Address <
firstAddress
End If
End With
End Sub