title: Error when clearing multiple cells in Excel
body: <p>I'm using Worksheet_Change to make a value (either 1 or 0) appear in the next cell (Bx) when a value is entered in a range of cells (A1:A10).</p>
  <pre><code>Private Sub Worksheet_Change(ByVal Target As Range)
      If Not Intersect(Target, Range(&quot;A1:A10&quot;)) Is Nothing Then
          If Target.Value = 1 Then
              Target.Offset(0, 1).Value = 1 
          Else:
              Target.Offset(0, 1).Value = 0 
          End If
      End If
  End Sub
  </code></pre>
  <p><a href="https://i.stack.imgur.com/NrPD8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NrPD8.png" alt="enter image description here" /></a></p>
  <p>The problem occurs when I try to clear the cells in column A.
  When I select the cells I want to clear and press &quot;Delete&quot; I get &quot;Run-time error '13' - Type mismatch&quot; on the line &quot;IF Target.Value = 1&quot;.</p>
  <p>I would also like the cells in the B column to be cleared if I clear cells in the A column. E.g. if I delete cell A2:A5, B2:B5 should be cleared.</p>
  <p>From what I understand the problem is that when selecting multiple cells it returns an array as the Target, and this is a mismatch with the Integer.</p>
  <p>Is there a way around this problem?</p>