title: How to call a function on ENTER key in Excel using vba
body: <p>Google should provide me with ample examples but none of them seem to work</p>
  
  <p><strong>What I want:</strong> Everytime the user presses, and then releases, the ENTER key, for my program to do do something (ie. create a MsgBox, or call function Foo). I would prefer this in the form of a MWE</p>
  
  <p><strong>What I have done:</strong> I have tried <em>googling it</em> but none of the examples are functional. They compile, but don't do anything. I have also made sure to save in a macro compatible Excel format.</p>
  
  <p><strong>What I am using:</strong> I am using Excel 2016, 64 bit with Office 365</p>
  
  <p><strong>EDIT:</strong> The user is entering this information into the worksheet. I want to intercept the user input and everytime they press ENTER, take the cursor/active cell down two rows, so there is an empty cell below every cell. If the user presses tab, I want to take the cursor/active cell right two columns, so there si an empty cell to the right of every cell.</p>
  
  <p><strong>EDIT 2:</strong> here is a MWE of what I have right now which should work, but which does nothing. I am adding this to the worksheet, and not as a module</p>
  
  <pre><code>Sub SomeActions()
      MsgBox ("Hello")
  End Sub
  
  Private Sub Workbook_Open()
      Application.OnKey "~", "SomeActions"
  End Sub
  </code></pre>