Hi
Trying to auto-format a report using a macro, but I don't know enough code to do it!
I've got the macro set up, but I need to alter it so that it finds Total then puts a border on 7 colums in that row.
How can I reference the row that FIND has located to transfer it to a cell reference (ie so I don't just have "$A$1".
Also, I think I use FindNext to repeat this but how can I stop it once it's done all that it's found from top to bottom?
The code is below, many thanks in anticipation.
Sub InsertLine()
'
' InsertLine Macro
' Macro recorded 16/01/2008 by BMW (GB) Limited This macro will insert a line below each WIP.
'
' Keyboard Shortcut: Ctrl+Shift+R
'
MyRow = Cells.Find(What:="total", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False).Activate
MsgBox MyRow
Range("A:E").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Selection.Borders(xlEdgeTop).LineStyle = xlNone
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
End Sub


