我有一份工作中使用的电子表格,用于跟踪返回的合同。我设置了一个颜色键,以便我可以快速浏览表单,查看哪些合同仍然需要退回给我们以及该帐户所属的哪位客户经理。使用VBA在Excel中着色一系列单元格
客户经理的首字母缩写列在A列;从那里我想根据谁在A中输入姓名的首字母来为该行中的单元格范围着色(A:H)。现在,我有以下代码,但我不喜欢电子表格的样子整行彩色:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Column <> 1 Then Exit Sub
Select Case Target
Case "MKH"
Target.EntireRow.Interior.ColorIndex = 36
Case "MAH"
Target.EntireRow.Interior.ColorIndex = 39
Case "MJM"
Target.EntireRow.Interior.ColorIndex = 34
Case "JVE"
Target.EntireRow.Interior.ColorIndex = 35
Case Else
Target.EntireRow.Interior.ColorIndex = 0
End Select
PS我们办公室的大多数工作人员仍在使用Office 2003,因此条件格式不适用。
是的,这工作!非常感谢 :-) – JTone 2010-07-26 15:35:31