- 帖子
- 976
- 主題
- 7
- 精華
- 0
- 積分
- 1018
- 點名
- 0
- 作業系統
- Win10
- 軟體版本
- Office 2016
- 閱讀權限
- 50
- 性別
- 男
- 註冊時間
- 2013-4-19
- 最後登錄
- 2026-5-26
|
回復 14# av8d
不好意思,更新一下您原來的程式碼的一些地方如下紅字,不知是否更符合您需求? 請測試看看,謝謝
Public Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim xA As Range, xR As Range
Call 顏色
Set xA = [A4:G1000]
If Target.Column = 3 Then
'Set xA = [A4:G1000]
xA.Interior.Pattern = 0
If Intersect(xA, Target) Is Nothing Then Exit Sub
For Each xR In xA.Rows
If Not Intersect(xR, Target) Is Nothing Then
If Cells(xR.Row, 3) <> "" Then
xR.Interior.Color = GBY
Else
Cells(xR.Row, 3).Interior.Color = GBY
End If
End If
Next
Else
xA.Interior.Pattern = 0
End If
End Sub |
|