Answers for "Highlight Row and Column border in Excel"

0

Highlight Row and Column border in Excel

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
    Cells.Borders.LineStyle = xlNone
    With ActiveCell
        With .EntireRow
            With .Borders(xlEdgeTop)
                .Color = RGB(0, 176, 80) 'green (change as desired)
                .LineStyle = xlContinuous
                .Weight = xlMedium 'or xlThin, xlThick, and xlHairline (change as desired)
            End With
            With .Borders(xlEdgeBottom)
                .Color = RGB(0, 176, 80)
                .LineStyle = xlContinuous
                .Weight = xlMedium
            End With
        End With
        With .EntireColumn
            With .Borders(xlEdgeLeft)
                .Color = RGB(0, 176, 80)
                .LineStyle = xlContinuous
                .Weight = xlMedium
            End With
            With .Borders(xlEdgeRight)
                .Color = RGB(0, 176, 80)
                .LineStyle = xlContinuous
                .Weight = xlMedium
            End With
        End With
    End With
End Sub
Posted by: Guest on May-05-2022

Code answers related to "Highlight Row and Column border in Excel"

Browse Popular Code Answers by Language