0
我有一個巨大的數據格式化爲條件格式,但只有10%的單元格是通過條件格式着色的,所以我只想將彩色單元格的顏色複製到複製範圍跳過將條件格式化顏色從一個範圍複製到另一個範圍的白色VBA Excel
這是將條件格式顏色從範圍複製到範圍的代碼。我想知道如何跳過白色不被複制,這樣我就可以減少90%這一循環時間
Sub MatchColors2()
Dim rngTo As Excel.Range
Dim rngFrom As Excel.Range
Dim i As Long
Dim j As Long
Set rngFrom = ActiveSheet.Range("C5:G1000")
Set rngTo = ActiveSheet.Range("I5:M1000")
For i = 1 To rngFrom.Areas.Count
For j = 1 To rngFrom.Areas(i).Cells.Count
rngTo.Areas(i).Cells(j).Interior.Color =rngFrom.Areas(i).Cells(j).DisplayFormat.Interior.Color
Next j
Next i
End Sub
感謝
優秀..謝謝 –