返回列表 上一主題 發帖

[發問] 一邊輸入一邊即時比對

回復 7# jesscc

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
    If Target.Row < 7 Then Exit Sub '我多加這行
    If Target.Column <> 5 Then Exit Sub
    If Target.Count > 1 Then Exit Sub
    Application.EnableEvents = False   '改放這裡
    If Sheets("DATA").[b:b].Find(Target, , , 1) Is Nothing Then
      ' 刪掉 Application.EnableEvents = False   '停止物件能觸發事件      
       Target.Offset(, -3) = "?"
        Target.Offset(, -3).Font.ColorIndex = 3
        Else
        Target.Offset(, -3) = ""
        Target.Offset(, -3).Font.ColorIndex = 0
      ' 刪掉 Application.EnableEvents = True      '恢復物件能觸發事件   
    End If
     Application.EnableEvents = True    '改放這裡

End Sub

TOP

        靜思自在 : 【時間成就一切】時間可以造就人格,可以成就事業,也可以儲積功德。
返回列表 上一主題