Discussion Locked

Excel macro chg font based on cell value

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I want to make the top border for a row set to heavy black line IF the value of the first cell in the current row begins with "CUST:". Seems simple, but I can't find it.

5 replies

by syscokid

You can use conditional formatting but it appears that you are limited to thin lines only. Is there another way you can highlight your data, perhaps with colors or shading? Click on Format, Conditional Formatting to see what I mean.

by lewis_rs

The main problem is actually how to set the loop looking for that value.
I should probably get a class in VB.

by graemeh

This would be one way:

Sub ApplyBorders()

If InStr(ActiveCell.Value, "CUST") Then
ActiveCell.EntireRow.Select
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThick .ColorIndex = xlAutomatic
End With
End If

End Sub

HTH

This discussion is closed to new replies.