title: Excel VBA Clear Active Cell
body: <p>So I am needing to do a few things, the first is run a macro when the delete key is pressed, so I found this:</p>
  
  <pre><code>Private Sub Worksheet_Activate()
  Application.OnKey "{DELETE}", "Intercept"
  End Sub
  
  Private Sub Worksheet_Deactivate()
  Application.OnKey "{DELETE}"
  End Sub
  </code></pre>
  
  <p>Now according to what I read, this will in turn make the delete key useless so I also need it to clear the currently active cell at the same time, I found this:</p>
  
  <pre><code>Sub SetValue()
  Worksheets("Sheet1").Activate
  ActiveCell.Value = 35
  End Sub
  </code></pre>
  
  <p>and this:</p>
  
  <pre><code>Selection.Clear
  </code></pre>
  
  <p>However, I am a new to VBA so I don't really know how to combine these to use the clear function on delete :).. Any help would be greatly appreciated, thank you.</p>