早上好,
我有一个C8:C17的范围有些单元格是红色的,有些是没有颜色的。我希望将不带颜色的单元格转移到A列。
这是我的代码:
Dim a As Long
a = 1 'we set the row where we start filling in the single sames
If Range("C8:C17").Interior.ColorIndex = xlColorIndexNone Then
Cells(a, "A").Value = Range("C8:C17").Value
a = a + 1
End If发布于 2017-06-14 20:18:54
下面的代码遍历Range("C8:C17")中的所有单元格,并检查当前单元格是否未着色。如果不是colores,则将其粘贴到A列的下一个空行(从第一行开始)。
Option Explicit
Sub CopyColCells()
Dim a As Long
Dim C As Range
a = 1 'we set the row where we start filling in the single sames
For Each C In Range("C8:C17")
If C.Interior.ColorIndex = xlColorIndexNone Then
Cells(a, "A").Value = C.Value
a = a + 1
End If
Next C
End Subhttps://stackoverflow.com/questions/44544555
复制相似问题