- 帖子
- 976
- 主題
- 7
- 精華
- 0
- 積分
- 1018
- 點名
- 0
- 作業系統
- Win10
- 軟體版本
- Office 2016
- 閱讀權限
- 50
- 性別
- 男
- 註冊時間
- 2013-4-19
- 最後登錄
- 2026-5-26
|
回復 11# cypd
請測試看看,謝謝
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Arr, xD, C%, T$, m&, i&
If Target.Column = 3 Then C = 3
If Target.Column = 4 Then C = 4
Set xD = CreateObject("Scripting.Dictionary")
With Sheets("客戶基本資料")
Arr = .Range(.Cells(1, C), .Cells(Rows.Count, C).End(3))
.Range(.Cells(1, C), .Cells(Rows.Count, C).End(3)).Font.ColorIndex = 0
.Range(.Cells(1, C), .Cells(Rows.Count, C).End(3)).Interior.ColorIndex = 0
For i = 1 To UBound(Arr)
T = Arr(i, 1)
If xD.Exists(T) Then
m = xD(T)
Cells(m, C).Font.ColorIndex = 3
Cells(m, C).Interior.ColorIndex = 36
Cells(i, C).Font.ColorIndex = 3
Cells(i, C).Interior.ColorIndex = 36
End If
xD(T) = i
Next
End With
End Sub |
|