Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 90739

How can I add a thick bottom border to a range of rows when the cell value changes?

$
0
0

I have code that will insert a blank row when a cell value changes.

How can I modify this to instead add a thick bottom border? The border would go from column A to column AB every time the value in column B changes

Sub InsertRows()
Dim lastRow As Long
Dim rowPtr As Long

lastRow = Range("B"& Rows.Count).End(xlUp).Row
For rowPtr = lastRow To 2 Step -1
    If Not IsEmpty(Range("B"& rowPtr)) Then
        If Range("B"& rowPtr) <> Range("B"& rowPtr - 1) Then
            Range("B"& rowPtr).EntireRow.Insert
        End If
    End If
Next

End Sub

Viewing all articles
Browse latest Browse all 90739

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>