Sub BBB()
Dim rng As Range, sAddr As String
Set rng = Columns(3).Find(What:="Subtotal ", _
After:=Cells(Rows.Count, "C").End(xlUp), _
LookAt:=xlPart, LookIn:=xlValues, _
MatchCase:=False)
If Not rng Is Nothing Then
sAddr = rng.Address
Do
With rng.Offset(1, -2).Range( _
"A1:G1").Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Set rng = Columns(3).FindNext(rng)
Loop While rng.Address < sAddr
End If
End Sub
--
Regards,
Tom Ogilvy
"aca" wrote in message
...
Thank you Tom; but I'm afraid that is too advanced for me (I don't
really master DIM...); my macro with your lines -as ssuch- doesn't
work.
Leave it at that; I cannot ask you to educate me from scratch now!
But just in case you have nothing better to do, what I'm trying is (in
a macro for book keeping) search the column of the expense items (C)
for rows headed "Subtotal "; and for each of these, draw a line all
across the page (at the top of the following row) to mark the beginning
of a new batch of items for the next subtotal.
At present I do it like this (which is slow indeed)
-----------------------------------------------------------
Do While ActiveCell < "Grand Total" ' this is the last row in
my list
Cells.Find(What:="Subtotal ", After:=ActiveCell,.).Activate
ActiveCell.Offset(1,-2).Select.
ActiveCell.Range("A:G").Select
With Selection.Borders(xlEdgeTop)
LineStyle = xlContinuous.
End With
Loop
------------------------------------------------------------
But, as I said, don't go into it if you're busy. It's up to me to learn
DIM . Thanks.
ACA
--
aca
------------------------------------------------------------------------
aca's Profile:
http://www.excelforum.com/member.php...o&userid=25933
View this thread: http://www.excelforum.com/showthread...hreadid=546246