Conditional formatting

K

Karen53

Hi,

I keep getting an error stating it can't create the top line. It errors at
the LineStyle Continuous. I don't know why. What do I need to check?

With Range("L2")
.FormatConditions.Delete
.HorizontalAlignment = xlCenter
.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _
Formula1:="=""""""Gross Up"""""""
.FormatConditions(1).Borders(xlRight).LineStyle = xlNone
With .FormatConditions(1).Borders(xlLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.FormatConditions(1).Borders(xlTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With .FormatConditions(1).Borders(xlBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
End With
 
J

JLGWhiz

It should not make any difference, but out of curiosity, is Range("L1") a
merged cell?
 
J

JLGWhiz

Could also be a syntax problem:
Try xlEdgeTop, xlEdgeLeft, xlEdgeBottom
Se if you still get the error.
 
K

Karen53

Hi,

Thank you for your reply. I tried the xlEdgeLeft etc. but I still get an
error at the .linestyle = xlContinuous stating it can't process the line.

I did the same thing in another cell and it works perfectly. I see no
difference between the two except the condition.

Is there anything else I should check?

thanks
 
K

Karen53

I got it. It looks like it had to do with the number of quotes on the
condition.

Thanks for your help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top