View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett[_4_] Don Guillett[_4_] is offline
external usenet poster
 
Posts: 2,337
Default With active cell

If I understood you correctly, you wanted to find Mr. Smith and format a
ANOTHER cell based on that location.

Sub FormatOffset()
Range(Columns("b").Find("Mr Smith").address).Offset(1, 2).Select
myBorders = Array(, xlEdgeLeft, xlEdgeTop, xlEdgeBottom, xlEdgeRight)
For i = 1 To UBound(myBorders)
With Selection.Borders(myBorders(i))
.LineStyle = xlContinuous
.Weight = xlMedium
End With
Next
Selection.Font.Bold = True
End Sub

to do range("a foundrow:e foundrow"), use this

Sub Formatfoundrow()
x = Columns("b").Find("Mr Smith").Row
MsgBox x
Range(Cells(x, 1), Cells(x, 5)).Select
myBorders = Array(, xlEdgeLeft, xlEdgeTop, xlEdgeBottom, xlEdgeRight)
For i = 1 To UBound(myBorders)
With Selection.Borders(myBorders(i))
.LineStyle = xlContinuous
.Weight = xlMedium
End With
Next
Selection.Font.Bold = True
End Sub



--
Don Guillett
SalesAid Software

"kevin" wrote in message
...
Hope this makes it a little clearer.

Range("B4:B18").Select
Selection.Find(What:="Mr Smith", After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows,

SearchDirection:= _
xlNext, MatchCase:=False).Activate
'make relative
'Active cell.Select
'Range("A13:E13").Select
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Selection.Font.Bold = True