I have the following code in the worksheet change mod and I want to clean it up:
That is actually only about 1/3 of the code. I repeat that over and over.
I did not use conditional formatting b/c I copy and paste these cells over and over and when I do that the formatting goes with it and bogs excel down. I couldn't do paste special b/c some of the cells are merged. Thus I resorted to VBA.
There has got to be a better way to do what I am doing, perhaps a loop.
Code:
If Range("B13") = 1 Then
Range("U6:Y6").Interior.Color = vbYellow
Else
Range("U6:Y6").Interior.Color = vbWhite
End If
If Range("C13") = 1 Then
Range("U7:Y7").Interior.Color = vbYellow
Else
Range("U7:Y7").Interior.Color = vbWhite
End If
If Range("D13") = 1 Then
Range("U8:Y8").Interior.Color = vbYellow
Else
Range("U8:Y8").Interior.Color = vbWhite
End If
If Range("E13") = 1 Then
Range("U9:Y9").Interior.Color = vbYellow
Else
Range("U9:Y9").Interior.Color = vbWhite
End If
If Range("F13") = 1 Then
Range("U10:Y10").Interior.Color = vbYellow
Else
Range("U10:Y10").Interior.Color = vbWhite
End If
If Range("G13") = 1 Then
Range("U11:Y11").Interior.Color = vbYellow
Else
Range("U11:Y11").Interior.Color = vbWhite
End If
If Range("H13") = 1 Then
Range("U12:Y12").Interior.Color = vbYellow
Else
Range("U12:Y12").Interior.Color = vbWhite
End If
That is actually only about 1/3 of the code. I repeat that over and over.
I did not use conditional formatting b/c I copy and paste these cells over and over and when I do that the formatting goes with it and bogs excel down. I couldn't do paste special b/c some of the cells are merged. Thus I resorted to VBA.
There has got to be a better way to do what I am doing, perhaps a loop.