Reputation: 45
I have the following code written on excel 2013 english and it works fine. but when i run it on excel 2007 german, it stuck on this line (if rngFrom.... 3rd line on the code) How can I solve this?
For j = 1 To rngFrom.Cells.Count
rngTo.Cells(j).Value = rngFrom.Cells(j)
If rngFrom.Cells(j).DisplayFormat.Interior.Color <> rngFrom.Cells(j).Interior.Color Then
rngTo.Cells(j).Interior.Color = rngFrom.Cells(j).DisplayFormat.Interior.Color
End If
Next j
Upvotes: 0
Views: 631
Reputation: 149315
but when i run it on excel 2007 german, it stuck on this line (if rngFrom.... 3rd line on the code) Any idea..how i can solve this?.
Range.DisplayFormat
Property was added from xl2010+ onwards.
Please see THIS MSDN link.
Quote form that link (In case the link dies off):
EDIT:
I believe what you are trying to compare the conditional formatting color with the cells' interior color. If yes then you can use this code as well
For j = 1 To rngFrom.Cells.Count
rngTo.Cells(j).Value = rngFrom.Cells(j)
If rngFrom.Cells(j).FormatConditions(1).Interior.Color <> _
rngFrom.Cells(j).Interior.Color Then
rngTo.Cells(j).Interior.Color = _
rngFrom.Cells(j).FormatConditions(1).Interior.Color
End If
Next j
I am assuming that there is only one condition in the conditional formatting.
Upvotes: 1