Thread: OnKey
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
HERNAN HERNAN is offline
external usenet poster
 
Posts: 103
Default OnKey

Right, else won't work, nor the rest of the line...

Forgetting the ELSE word, how would you write the code to express what I
wrote (without the else part)?

Thank you for your time.

Hernan

"AA2e72E" wrote:

I don't think you can use the else:

Run

Application.OnKey "+~" ThisWorkbook.TM"

Where TM is a macro in the ThisWorkbook module: it should use SendKeys to
send the keystrokes .. see the help files. Must be run as soon as your
workbook opens .. see auto events in the help files.

For the ELSE part, you might have to enumerate all the other keystrokes ...
messy ... you might be betther of picking another keystroke for Sending the
ELSE keystrokes.

"Hernan" wrote:

I have a sheet with 3 cols by 40 rows, where the 1st col is for date, 2nd for
initials, and 3rd for comments. The comments can go for 80 chars at the max
on one line. Then I would like to press resturn just to go down one row on
the same column and continue the comment, etc. If SHIFT-RETURN ( OnKey+~) is
pressed then the cursor should jump DOWN 1 row and LEFT twice.

( If Onkey = "+~" then {DOWN} {LEFT} {LEFT} Else {DOWN})

How can I accomplish that in VB?

TIA

Hernan