ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   bottom borders in a For Loop (https://www.excelbanter.com/excel-programming/370376-bottom-borders-loop.html)

CJ[_5_]

bottom borders in a For Loop
 
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




All times are GMT +1. The time now is 12:44 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com