我已对 Excel 中的数据透视表的列应用了条件格式,它会自动将大于特定值的单元格着色为红色。
我还想将这些红细胞分别提取到同一张纸中的特定区域。
可以通过使用宏来完成吗?或者“if”条件在这里会有帮助吗?
您的条件格式参数是什么?您可以通过编程方式使用相同的逻辑。或者,您可以编写代码来检查单元格的颜色。
'specify the cell you want the color for
x = InputBox("what cell")
Range("a1") = Range(x).Interior.Color
If Range(x).Interior.Color = Range("a1") Then
MsgBox "yes the color is right"
End If
数据透视表示例
'where cell is something your looking for that is in the cell
ActiveSheet.PivotTables("PivotTable1").PivotSelect "'cell'", xlDataAndLabel + xlFirstRow, True
x = Selection.Interior.Color