Advancing from Cell to Cell on Key Press
Lotus and Excel function quite differently in terms of macros. Paste this
code into a sheet (right click the tab - View Code - Paste) and change the
values of A1, B2, or C3 and trace the code through to see what is happening
(F9 to place a break point -F8 to advance one line of code at a time).
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ErrorHandler
Application.EnableEvents = False 'Place a break point here
Select Case Target.Address
Case "$A$1"
ActiveSheet.Range("B2").Select
Call Message1(Target)
Case "$B$2"
ActiveSheet.Range("C3").Select
Call Message2(Target)
Case "$C$3"
ActiveSheet.Range("A1").Select
Call Change(Target)
End Select
ErrorHandler:
Application.EnableEvents = True
End Sub
Private Sub Message1(ByVal Target As Range)
MsgBox Target.Value & " Changed This"
End Sub
Private Sub Message2(ByVal Target As Range)
MsgBox Target.Value & vbTab & Environ("UserName")
End Sub
Private Sub Change(ByVal Target As Range)
Target.Value = Target.Value & " Changed The Other"
End Sub
--
HTH...
Jim Thomlinson
"Lee C" wrote:
Hi all, I am in the process of migrating from Lotus 123 to Excel. My macro
for advancing through the various fields in my spreadsheet will neither run
nor translate. Sooooo! I need help. I can select a field for input [
example - Range ("F5").Select] at this point I want the program to suppend
execution while I input information then resume and proceed to the next field
when I press the return key (or another appropriate key). Any Help would be
greatly appreciated.
Thanks,
--
Lee C
|