Excel用公式判断有颜色的单元格

2024-11-15 16:24:33
推荐回答(1个)
回答1:

用自定义函数,需要辅助列
或直接用代码完成
Sub 提取颜色()
Columns("P") = ""
Dim I%
For I = 2 To Range("J65536").End(xlUp).Row
If Cells(I, "J").Interior.ColorIndex = 6 Then
Cells(I, "P") = Cells(I, "J")
End If
If Cells(I, "M").Interior.ColorIndex = 6 Then
Cells(I, "P") = Cells(I, "M")
End If
Next
End Sub