1

How do I find all cells containing a text value such as merchant_id and change the background color of those cells to a specific color?

4

1 回答 1

1

此宏将使用当前选定的范围并检查每个单元格是否存在merchant_id. 如果属实,则将其标记为栗色。要选择特定颜色,最好的方法是记录宏并查看它创建的值。取这些数字并替换With块的内容

Sub MarkCellsInSelection()
    For Each c In Selection
        If c.Value = "merchant_id" Then

            With c.Interior
                .Pattern = xlSolid
                .PatternColorIndex = xlAutomatic
                .ThemeColor = xlThemeColorAccent2
                .TintAndShade = 0.399975585192419
                .PatternTintAndShade = 0
            End With
        End If
    Next
End Sub
于 2013-09-16T18:26:06.420 回答