No announcement yet.

run a Macro upon Enter key

  • Filter
  • Time
  • Show
Clear All
new posts

  • run a Macro upon Enter key

    Sorry. I know Dave Hawley has posted "automatically run excel macros when a cell changes/enter data" but I'm being a bit thick!!

    I'm trying to get a macro to delete an entry in cell H12 of a worksheet called "Detail" if a new number is typed into cell E6 of the same sheet and either "Enter" or "tab" keyed to commit the number.

    I've read a few responses about worksheet_change event, but am not quite sure how to tell the "Private sub worksheet selectionChange (ByVal Target as Range) sub to know that it's the change in cell E6 that runs my macro called data_delete (or even simpler, just deletes the data in cell H12)

    I'd be grateful for a guide in really simple english as i'm feeling very stupid at present!

    Many thanks in advance.


  • #2
    Re: run a Macro upon Enter key

    Searched elsewhere as well as here and get a response which did the job for me, so i've posted the solution in case anyone else comes across this later on and needs the answer:-

    Private Sub Worksheet_Change(ByVal Target As Range)
      If Target.Address = "$E$6" Then
       End If
    End Sub
    Answered by e-mail with thanks to

    Chip Pearson
    Pearson Software Consulting, LLC [email protected]
    (913) 432-5676
    Last edited by royUK; November 15th, 2005, 23:03. Reason: edit code tags