title: Avoid selection in a form when double-click
body: <p>In <a href="/questions/tagged/excel-2007" class="post-tag" title="show questions tagged 'excel-2007'" rel="tag">excel-2007</a> I have a macro that when double clicking a cell, a form will open.</p>
  
  <p>When the relevant cell is located within the range in which the form will appear, an undesired selection is carried out in the form. </p>
  
  <p>How can I avoid this selection?</p>
  
  <hr>
  
  <p><em>From a suggested edit by hammejdp on barrowc's answer:</em></p>
  
  <p>I use this <em>(i.e. BeforeDoubleClick event)</em> already but not fix the problem</p>
  
  <pre><code>Private Sub Workbook_SheetBeforeDoubleClick(ByVal sh As Object, ByVal target As Range, cancel As Boolean)
  
  Call s_Click_DoubleClick(sh, target, cancel)
  
  End Sub
  
  Private Sub Workbook_SheetBeforeRightClick(ByVal sh As Object, ByVal target As Range, cancel As Boolean)
  
  Call s_Click_DoubleClick(sh, target, cancel)
  
  End Sub
  
  Private Sub s_Click_DoubleClick(sh, target, cancel)
  
  Application.ScreenUpdating = False
  
  If sh.Name &lt;&gt; "Legende" Then
      cancel = True
      ' Maak gebruik van een range
      vRowCount = target.Rows.Count
      vColumnCount = target.Columns.Count
      f_Input.TextBox1.Value = vColumnCount
  </code></pre>