Hello,
I’m looking for a routine that will run a macro after the Enter key is pressed on a cell in a range (M33:M2033).
I have a routine I received that does something like this but only addresses a single cell. I would like the condition to run on any cell in the range. There will be other conditions set prior to running the code but let’s start with just seeing if I can get this to trigger as hoped.
Here is my current single cell routine:
Thanks for viewing,
Steve K.
I’m looking for a routine that will run a macro after the Enter key is pressed on a cell in a range (M33:M2033).
I have a routine I received that does something like this but only addresses a single cell. I would like the condition to run on any cell in the range. There will be other conditions set prior to running the code but let’s start with just seeing if I can get this to trigger as hoped.
Here is my current single cell routine:
VBA Code:
Public cellAddress As String ‘<== NOTE: This must be placed at top of All Code (not part of Subs) ===
‘- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'------ Run code after Enter in K7 ------
If cellAddress = "$K$7" Then
MsgBox "Do Something"
End If
cellAddress = ActiveCell.Address
End Sub
Thanks for viewing,
Steve K.