Excel-VBA - How to identify Target range (more than 1 cell) is deleted in a Worksheet_Change function?
<p>I am trying to find if a user deletes values in certain cells in column B then cells in same rows in column X are also deleted using worksheet_change function.</p>

<p>When I delete only one cell in column B then IsEmpty(Target) returns true and I am able to clear the same row cell in column X. </p>

<p>However, when select multiple cells in column B and press delete button, the IsEmpty(Target) returns False. Now here Target is range of multiple cells. I just can't find a way to find if a user has deleted range of values in column B at the same time. Any help would be much appreciated. </p>

<p>Below code works when one cell is deleted but not when a range of cells are deleted.</p>

<pre><code>Private Sub Worksheet_Change(ByVal Target As Range)

    If Target.Column &lt;&gt; 2 Then Exit Sub
    If Target.Columns.Count &gt; 1 Then Exit Sub

    If IsEmpty(Target) Then

        Application.EnableEvents = False
        ActiveSheet.Range("X" &amp; Target.Row &amp; ":X" &amp; Target.Row + Target.Rows.Count - 1).ClearContents
        Application.EnableEvents = True
    End If

End Sub
</code></pre>

<p>Thanks
Uttam</p>