Macro to Conditionally format Thick Border
I am still not 100% clear on what you require but if you are wanting to
check the value of each cell in the range A2:A18 and set the formating
in columns B:F in each row based on that value then maybe like this:
Sub Frmt()
Dim cell As Range
For Each cell In Range("A2:A18")
With Range(Cells(cell.Row, 2), Cells(cell.Row, 6))
Select Case cell.Value
Case "Y1"
.Borders(xlEdgeTop).Weight = xlThick
.Interior.ColorIndex = 36
Case "Y"
.Borders(xlEdgeTop).Weight = xlThin
.Interior.ColorIndex = 36
Case "G1"
.Borders(xlEdgeTop).Weight = xlThick
.Interior.ColorIndex = 35
Case "G"
.Borders(xlEdgeTop).Weight = xlThin
.Interior.ColorIndex = 35
End Select
End With
Next cell
End Sub
Regards
Rowan
nuver wrote:
Thanks Rowan
Works exactly as I asked. The problem is I did not ask the question
correctly. The formatting is what I am looking for but the source and
destination are not exactly what I wanted. I am going to try to explain
myself a little better, sorry I did not get it right the first time.
Thanks for the quick response.
If cell A2 meets the criteria I want the formatting to pertain to
B2:F2
If cell A3 meets the criteria I want the formatting to pertain to
B3:F3
If cell A4 meets the criteria I want the formatting to pertain to
B4:F4
If cell A5 meets the criteria I want the formatting to pertain to
B5:F5
and so on....
Thanks again!
|