All,
I have a macro, I'm utilizing to "try" and underline part of a row were the values in a column change. In the worksheet, where the field "TICS #" changes I would like to underline columns "D" to "R". I have it correct where the line is created when column "I" changes; however, the underline starts there too. Like I had mentioned, I would like the underline to go from column "D" to column "R". Currently, it's going from column "I" to column "Z". As always, thanks in advance. Here is the code and I've attached a sample file.
Sub Underline()
Dim rng As Range, lRw As Long, lCol As Long
lRw = Range("A" & Rows.Count).End(xlUp).Row
lCol = Columns("R:R").Column
Set rng = Range(Cells(1, 1), Cells(lRw, lCol))
With rng.Resize(lRw + 1)
.Borders(xlInsideHorizontal).LineStyle = xlNone
End With
For Each c In rng.Columns(9).Cells
If c.Value <> c.Offset(1, 0).Value Then
With c.Resize(1, lCol).Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 9
.Weight = xlThick
End With
End If
Next c
End Sub
Bookmarks