|
こんにちは
グループ化使う事ないので、これでいいのかどうか分かりませんけど、
Private Sub Worksheet_Change(ByVal Target As Range)
Dim i As Long
Dim t As Long
Dim s As Long
Dim e As Long
Dim r As Range
Dim v As Variant
With Target
If .Cells.Count > 1 Then Exit Sub
If .Columns(1).OutlineLevel < 2 Then Exit Sub
Application.EnableEvents = False
Application.ScreenUpdating = False
t = .Column
For i = t - 1 To 2 Step -1
If Me.Cells(1, i).Columns(1).OutlineLevel = 1 Then
s = Me.Cells(1, i).Column
Exit For
End If
Next
For i = t + 1 To Me.Columns.Count
If Me.Cells(1, i).Columns(1).OutlineLevel = 1 Then
e = Me.Cells(1, i).Column
Exit For
End If
Next
Set r = Me.Range(Me.Cells(.Row, s + 1), Me.Cells(.Row, e - 1))
v = Application.Match("×", r, 0)
If IsError(v) Then
Me.Cells(.Row, s).ClearContents
Else
Me.Cells(.Row, s).Value = "×"
End If
Application.EnableEvents = True
Application.ScreenUpdating = True
End With
End Sub
|
|