OnKey

G

Guest

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
 
G

Guest

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.
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top