给代码粘贴添加颜色

我有以下这是将新的行数据移动到目标工作表(wsdest)。 我添加了(Interior.color = RGB(10,90,175)部分,以确保新添加的行添加了特定的颜色,所以他们脱颖而出。它工作正常,但我似乎无法得到它的工作随着颜色的变化。

With wsSource RowCount = .Cells(.Cells.Rows.Count, "A").End(xlUp).Row For i = 1 To RowCount If .Cells(i, "BH").Value = 5 Then If WorksheetFunction.CountIf(wsDest.Range("A:A"), .Cells(i, "A").Value) = 0 Then .Cells(i, "A").Copy wsDest.Cells(.Rows.Count, "A").End(xlUp).Offset(1) wsDest.Cells(.Rows.Count, "A").Interior.Color = RGB(10, 90, 175) End If End If Next i End With 

尝试下面的代码,并进行一些修改:

 With wsSource RowCount = .Cells(.Rows.Count, "A").End(xlUp).Row ' <-- modifed this line For i = 1 To RowCount If .Cells(i, "BH").Value = 5 Then If WorksheetFunction.CountIf(wsDest.Range("A:A"), .Cells(i, "A").Value) = 0 Then .Cells(i, "A").Copy wsDest.Cells(wsDest.Rows.Count, "A").End(xlUp).Offset(1) ' <-- modifed this line wsDest.Cells(wsDest.Rows.Count, "A").End(xlUp).Interior.Color = RGB(10, 90, 175) ' <-- modifed this line End If End If Next i End With