Try this
Sub underlineabovetotal()
With Worksheets("sheet3").Range("a1:a500")
Set c = .Find("Total", After:=Range("a1"), LookIn:=xlValues, _
LookAt:=xlWhole, SearchOrder:=xlByRows, _
SearchDirection:=xlNext,MatchCase:=False)
If Not c Is Nothing Then
firstAddress = c.Address
Do
With .cells(c.Row - 1, "a").Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThick
End With
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(E-Mail Removed)
"CAM" <(E-Mail Removed)> wrote in message
news:6D183A99-6EEF-40A2-9B94-(E-Mail Removed)...
> Hello,
>
>
> I would like to add a border using vba coding to a worksheet this should
> only applies when there is a cell containing the text "Total" in column
> A. Now I want the border on top of the "Total" starting from column A - H.
> The worksheet is large and will have many "Total" in it. How do I code
> that? Any tips will be appreciated. Thank you in advance.
>
> Regards,