繁体   English   中英

Excel 公式可以在colors的基础上在Q,V,W,X,Y,Z列写出具体的列

[英]Excel formula which can write specific column on the basis of colors in column Q,V,W,X,Y,Z

我有一个 excel 文件,它可能包含也可能不包含 Q、v、w、x、y、z 列中的颜色。 如果这些列中的任何一个包含颜色,我需要在“颜色”列中写“是”,否则写“否”,有人可以帮我吗?

我可以实现这一目标的公式。

这可以通过创建一个宏来实现,这里是一个例子:

Sub YesMacro()
'
' Macro to write "Yes" if there is a fill color and "No" otherwise
' Applied to a selected range
'
Dim rng As Range: Set rng = Application.Selection
Dim c As Range
    For Each c In rng.Cells
        If (c.Interior.Color <> 16777215) Then
            c.FormulaR1C1 = "Yes"
        Else
            c.FormulaR1C1 = "No"
        End If
    Next c
End Sub

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM