Loading
Ozgrid Excel Help & Best Practices Forums

Excel Video Tutorials / Excel Dashboards Reports



Results 1 to 2 of 2

Thread: run a Macro upon Enter key

  1. #1
    Join Date
    2nd November 2004
    Location
    East Anglia, UK
    Posts
    28

    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.

    Alphy

    Excel Video Tutorials / Excel Dashboards Reports


  2. #2
    Join Date
    2nd November 2004
    Location
    East Anglia, UK
    Posts
    28

    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:-


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

    Chip Pearson
    Pearson Software Consulting, LLC
    www.cpearson.com chip@cpearson.com
    (913) 432-5676
    Last edited by royUK; November 15th, 2005 at 22:03. Reason: edit code tags

    Excel Video Tutorials / Excel Dashboards Reports


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Possible Answers

  1. Run Macro On Enter Key In TextBox
    By cbanks in forum EXCEL HELP
    Replies: 4
    Last Post: October 23rd, 2007, 05:41
  2. Macro To Enter Information On A New Line
    By Highflyer87 in forum EXCEL HELP
    Replies: 8
    Last Post: March 14th, 2007, 23:14
  3. macro to F2 on a cell and enter
    By excel_for_fun in forum EXCEL HELP
    Replies: 13
    Last Post: June 23rd, 2006, 21:57
  4. Run Macro on Enter
    By Et3rnal in forum EXCEL HELP
    Replies: 2
    Last Post: March 16th, 2005, 02:34
  5. Running a Macro when Enter is hit
    By nojy in forum EXCEL HELP
    Replies: 2
    Last Post: November 4th, 2004, 00:16

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
porno