bottom borders in a For Loop

C

CJ

Newbie here, hope you can help

snippet of code below - it puts the subtotal in col c and works good

However I also want a bottom border line to go across col B thru G ONLY on
the suttotal line

I know others may write the code differently but this is my first attempt.
Just looking for a line or so that will hopefully do the trick
Any help appreciated - Thanks Chris


Dim rng As Range, code As Variant
Dim i As Integer
Dim qty As Integer

Set rng = Range("b4:b50")
code = Range("b4").Value
For i = 1 To rng.Count

If code <> rng.Cells(i).Value Then
code = rng.Cells(i).Value
rng.Cells(i).Offset(-1, 2).Value = qty
qty = rng.Cells(i).Offset(0, 1).Value

b c d e f g
code amt subtotal
a 23
a 5 28
b 6
b 66
b 58 130
c 9
c 14 23
d 48
d 45
d 8
d 95 196
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top