Private Sub Worksheet_SelectionChange(ByVal Target As Range) Dim clvl As Variant If Application.Intersect(Target, Range("A1:A5")) Is Nothing Then Exit Sub If Target.Offset(-1, 0) <> "" Then clvl = Target.Offset(-1, 0) Range("A1:A5").ClearContents Target.Offset(-1, 0) = clvl End If End Sub
Private Sub Worksheet_Change
Dim clvl As Variant
If Application.Intersect(Target, Range("A1:A5")) Is Nothing Then Exit Sub
If Target.Offset(-1, 0) <> "" Then
clvl = Target.Offset(-1, 0)
Range("A1:A5").ClearContents
Target.Offset(-1, 0) = clvl
End If
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Dim clvl As Variant
If Application.Intersect(Target, Range("A1:C5")) Is Nothing Then Exit Sub
clvl = Target.Value
Application.EnableEvents = False
Select Case Target.Column
Case 1: 'A列の場合
Range("A1:A5").ClearContents
Case 2: 'B列の場合
Range("B1:B5").ClearContents
Case 3: 'C列の場合
Range("C1:C5").ClearContents
End Select
Target.Value = clvl
Application.EnableEvents = True
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Dim clvl As Variant
If Application.Intersect(Target, Range("A1:C5")) Is Nothing Then Exit Sub
clvl = Target.Value
Application.EnableEvents = False
Range(Cells(1, Target.Column), Cells(5, Target.Column)).ClearContents
Target.Value = clvl
Application.EnableEvents = True
End Sub