Hi, I have a short macro which I want to work only when a cell isn't coloured. It does generally work as expected, but when the cells are coloured it strips the colour out for some reason. The purpose of the macro is to reinstate an equation previously deleted, by copying the first non-blank cell directly above. When the cell (i,42) has a colour then equation isn't pasted in, but the colour still disappears, and I can't work out why. Can anyone explain it to me, please? Here is the important part of the code.
I can probably do a workaround by selecting the cell next door and pasting the colour from there, but I wish I knew why it was happening.
Code:
For i = rowno1 To rowno2
Cells(i, 42).Select
If Selection.Interior.ColorIndex = xlNone Then
x = Range("AP" & rown1).End(xlUp).Row
Range("AP" & x).Copy destination:=Range(Cells(rown1, col), Cells(rown2, col))
End If
Next i