Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Determining if selection change was the result of ENTER

How can I code vba to determine if the selection change on a worksheet was
the result of pressing the ENTER key?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Determining if selection change was the result of ENTER

You can capture the key press of the enter key (note there are two enter
keys) something like this...

With Application
.OnKey "{Enter}", "MyMacro"
.OnKey "~", "MyMacro"
End With

The macro MyMacro will have to mimic a normal enter but that is just
seleting the cell you want... Check out this link...

http://msdn.microsoft.com/library/de...HV05203370.asp
--
HTH...

Jim Thomlinson


"joeeng" wrote:

How can I code vba to determine if the selection change on a worksheet was
the result of pressing the ENTER key?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Determining if selection change was the result of ENTER

The problem is that I only want this to trigger on one worksheet, and only if
the {ENTER} results in an intersection with particular cells. I can't see
how I can make the OnKey work for this circumstance. I might be missing
something though.

"Jim Thomlinson" wrote:

You can capture the key press of the enter key (note there are two enter
keys) something like this...

With Application
.OnKey "{Enter}", "MyMacro"
.OnKey "~", "MyMacro"
End With

The macro MyMacro will have to mimic a normal enter but that is just
seleting the cell you want... Check out this link...

http://msdn.microsoft.com/library/de...HV05203370.asp
--
HTH...

Jim Thomlinson


"joeeng" wrote:

How can I code vba to determine if the selection change on a worksheet was
the result of pressing the ENTER key?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Determining if selection change was the result of ENTER

I have figured out to accomplish this. Place the OnKey calls in the
beginning of the Worksheet_Activate and Worksheet_SelectionChange
subroutines. Then reset the OnKeys in the Worksheet_Deactivate and at the
end of the OnKey macros.

"joeeng" wrote:

The problem is that I only want this to trigger on one worksheet, and only if
the {ENTER} results in an intersection with particular cells. I can't see
how I can make the OnKey work for this circumstance. I might be missing
something though.

"Jim Thomlinson" wrote:

You can capture the key press of the enter key (note there are two enter
keys) something like this...

With Application
.OnKey "{Enter}", "MyMacro"
.OnKey "~", "MyMacro"
End With

The macro MyMacro will have to mimic a normal enter but that is just
seleting the cell you want... Check out this link...

http://msdn.microsoft.com/library/de...HV05203370.asp
--
HTH...

Jim Thomlinson


"joeeng" wrote:

How can I code vba to determine if the selection change on a worksheet was
the result of pressing the ENTER key?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Determining the Cell Address of a VLOOKUP Result in VBA [email protected] Excel Discussion (Misc queries) 3 April 9th 23 12:45 PM
Easily change Move selection after Enter option Paul S[_2_] Excel Discussion (Misc queries) 2 February 26th 08 09:13 PM
how to change "move selection after enter" in office 2007 Bert Excel Discussion (Misc queries) 2 June 7th 07 06:41 PM
Change from Column Selection to Cell Selection Lil Pun[_16_] Excel Programming 4 June 16th 06 10:38 PM
Determining the Selection on a non-active Sheet? Jim S.[_4_] Excel Programming 2 April 17th 04 03:59 AM


All times are GMT +1. The time now is 03:48 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"