You may use the following code instead of last one. In place of msgbox you can call some macro which you wish to run when "Enter" is pressed. The present code assumes column 3 as having the data instead of column 4 which you need.
Private Sub Worksheet_SelectionChange(ByVal Target As Range) Dim lastRow As Integer Dim lastCol As Integer lastRow = Range("A1") lastCol = Range("A2") 'The value of cell column and row will be recorded in Cells A1 and A2 Range("A1") = Target.Row Range("A2") = Target.Column If Intersect(Range("C:C"), Target) Is Nothing Then 'do nothing ElseIf lastCol = 3 And Range("A1") - lastRow = 1 Then MsgBox "it is changed" 'Change this code to call someMacro() Range("C" & lastRow).Activate 'Change as necessary End If End Sub Akhilesh Kumar Karna On Fri, May 8, 2009 at 7:55 PM, Doug <dsrmccl...@gmail.com> wrote: > > Thank you for the response. > > The problem with this code is that the macro run as soon as the cell > is selected. I want the macro to wait until the user presses "Enter". > I don't want the macro to run if the user every time the user clicks > on or goes to the cell. > > > On May 8, 12:14 am, Akhilesh Karna <akhiles...@gmail.com> wrote: > > The following code may be of help: > > > > open excel > > open visual basic editor > > double click sheet1 (or any other sheet) under microsoft excel objects > > Add the following code > > > > Private Sub Worksheet_SelectionChange(ByVal Target As Range) > > If Intersect(Range("C:C"), Target) Is Nothing Then > > 'do nothing > > Else > > MsgBox "it is changed" > > End If > > End Sub > > > > You can do many thing by just clicking a cell in column C (in this > example). > > > > Akhilesh Kumar Karna > > > > > > > > On Fri, May 8, 2009 at 4:58 AM, Doug <dsrmccl...@gmail.com> wrote: > > > > > I've got an Excel spreadsheet that I'm going to use a wedge program > > > with to capture data from an instrument and parse it into the sheet. I > > > would like to make it happen without having to use a mouse to click a > > > button. A hot key combo or a form would work but it would be really > > > sweet if I could just press Enter from the correct cell. > > > > > Is it possible to run a macro by simply hitting enter on a cell > > > without even entering any data in the cell? The active cell will > > > always be in column 4. > > > > > None of the answers I found online so far work for me. > > > > > Thanks. > > > Doug- Hide quoted text - > > > > - Show quoted text - > > > > --~--~---------~--~----~------------~-------~--~----~ ------------------------------------------------------------------------------------- Some important links for excel users: 1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at http://www.excelitems.com 2. Excel tutorials at http://www.excel-macros.blogspot.com 3. Learn VBA Macros at http://www.vbamacros.blogspot.com 4. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com If you find any spam message in the group, please send an email to: Ayush Jain @ jainayus...@gmail.com or Ashish Jain @ 26may.1...@gmail.com ------------------------------------------------------------------------------------- -~----------~----~----~----~------~----~------~--~---