Excel – 查找所有包含值和更改背景颜色的单元格

如何查找包含文本值(例如merchant_id)的所有单元格,并将这些单元格的背景颜色更改为特定的颜色?

这个macros将使用当前select的范围并检查每个单元格的merchant_id 。 然后标记栗色如果是真的。 要select一个特定的颜色,最好的方法是logging一个macros,看看它创build的值。 取这些数字并replaceWith块的内容

 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