| 
    
     |  | 学生です さん、こんばんわ。 
 イベントモジュール内で実行することでまたイベントがおきないように、
 Application.EnableEvents = False
 を設定します。
 
 ただし、このコマンドは強烈なので
 Application.EnableEvents = True
 を忘れると、その後イベントが起きませんので、必ず忘れずに戻しましょう。
 何かのエラーで中断して戻りそびれると困るので、Resumeで必ず通るようにしてあります。
 
 Private Sub Worksheet_Change(ByVal Target As Range)
 'イベントキャンセル
 Application.EnableEvents = False
 Dim MyR As Range, セル As Range, r1 As Range, r2 As Range
 '
 On Error Resume Next
 Set MyR = Columns("A:A").SpecialCells(xlCellTypeConstants, 23)
 'Targetが複数セルの場合もないとはいえない
 Set r1 = Target.SpecialCells(xlCellTypeConstants, 23)
 On Error GoTo 0
 If (Not r1 Is Nothing) And (Not MyR Is Nothing) Then
 For Each r2 In r1
 With r2
 If .Value <> "" Then
 For Each セル In MyR
 If (.Value = セル.Value) And (.Address <> セル.Address) Then
 .Select
 MsgBox .Value & "は、入力済みです", vbInformation
 .ClearContents
 
 Exit For
 End If
 Next
 End If
 End With
 Next
 End If
 '終了
 ExitMacro: 'TAG
 Set MyR = Nothing: Set セル = Nothing: Set r1 = Nothing
 'イベント監視開始
 Application.EnableEvents = True
 Exit Sub
 errout:
 MsgBox Error(Err), vbExclamation, "エラーで中断"
 Resume ExitMacro
 End Sub
 
 こんな感じです。
 
 
 |  |