View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Chip Pearson
 
Posts: n/a
Default Moving between cells

You should disable events in this procedure, and turn them back
on at the end.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'macro jump cell
Application.EnableEvents = False '<<<<<<<<<<<
If Target.Row = 12 And Target.Column = 7 Then 'jump A14
Target.Offset(2, -6).Select
End If

If Target.Row = 15 And Target.Column = 1 Then 'jump B14
Target.Offset(-1, 1).Select
End If
Application.EnableEvents = True '<<<<<<<<<<<
End Sub

Otherwise, you'll find that the macro is calling itself. The
SelectionChange code changes the Selection, which calls
SelectionChange again.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"nsv" wrote in
message ...

Look at this example which works with the DOWN-ARROW, which I
find more
simple than pushing a botton. It starts out at G11 and after
filling
out G11 you push the DOWN-ARROW. This makes the cursor jump to
A14,
etc.


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'macro
jump cell

If Target.Row = 12 And Target.Column = 7 Then 'jump A14
Target.Offset(2, -6).Select
End If

If Target.Row = 15 And Target.Column = 1 Then 'jump B14
Target.Offset(-1, 1).Select
End If

End Sub


--
nsv
------------------------------------------------------------------------
nsv's Profile:
http://www.excelforum.com/member.php...o&userid=26500
View this thread:
http://www.excelforum.com/showthread...hreadid=522094