FormatConditions border on a single edge

excel, vba

Solution

It seems that it is not `xlEdgeBottom` it is just `xlBottom`. So change the line:

`With .Borders(xlEdgeBottom)`

to

`With .Borders(xlBottom)`

and it worked for me

Problem

I am trying to add a border between rows when the data in column 1 changes. This code breaks at `.LineStyle = xlContinuous`. The error I get is "Unable to set the LineStyle property of the Border class". Is there an error in the code or an alternate way of doing this? ``` Sub AddBorders() With Range("A:B").FormatConditions.Add(Type:=xlExpression, Formula1:="=A1<>A2") With .Borders(xlEdgeBottom) .LineStyle = xlContinuous .ColorIndex = xlAutomatic .TintAndShade = 0 .Weight = xlThin End With End With End Sub ```

Original source