Вам потребуется использовать Application.Intersect
в сочетании с .Offset()
вместо метода Target.Address
.
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim AffectedRange As Range
Set AffectedRange = Application.Intersect(Target, Me.Range("B:B")) 'find all cells that were changed in column B
If AffectedRange Is Nothing Then Exit Sub 'exit if nothing in column B was changed
Application.EnableEvents = False 'make sure our value change doesn't trigger another Worksheet_Change event (endless loop)
On Error GoTo ENABLE_EVENTS 'make sure events get enabled even if an error occurs
Dim Cell As Range
For Each Cell In AffectedRange.Cells 'loop through all changed cells in column B
Cell.Offset(ColumnOffset:=1).Value = "" 'move from B one column to the right and reset value
Next Cell
ENABLE_EVENTS: 'in case of error enable events and report the error
Application.EnableEvents = True
If Err.Number <> 0 Then
Err.Raise Err.Number, Err.Source, Err.Description, Err.HelpFile, Err.HelpContext
End If
End Sub
При этом будет наблюдаться столбец B и удаляться значение в C всякий раз, когда ячейка в Б был изменен.