小弟我用比較笨的作法,不過呢是可以達到您要的效果就是了
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
For Each a In Range(Me.[a2], Me.[h17])
Select Case a
Case Me.[a1]
a.Interior.ColorIndex = 3
Case Me.[b1]
a.Interior.ColorIndex = 4
Case Me.[c1]
a.Interior.ColorIndex = 5
Case Me.[d1]
a.Interior.ColorIndex = 6
Case Me.[e1]
a.Interior.ColorIndex = 7
Case Me.[f1]
a.Interior.ColorIndex = 8
Case Me.[g1]
a.Interior.ColorIndex = 9
Case Me.[h1]
a.Interior.ColorIndex = 10
Case Else
a.Interior.Pattern = xlNone
End Select
Next
End Sub作者: kimbal 時間: 2010-7-15 00:31
建議加上一行(紅字)先把既有之顏色消去,若否....第一列(A1~H1)改變數字試試看
.....
If c.Row <> 1 Then
c.Interior.Color = xlNone
For i = 1 To lngNumCols
.....作者: PD961A 時間: 2010-7-15 09:28