Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA code for cursor movement without leaving scroll area


I have the following code to run using the control + enter. It works
great but when I add the vba code to move the cursor to the right, it
goes beyond the scroll area range I have set up (instead of going to
the next row & 1st cell in the scroll area).

Anyone got any ideas how to move the cursor without it leaving the
scroll area?

In other words, when I hit the conrol + Enter, I want the data from the
cell above to copy to the active cell & move the cursor to the next cell
without having to hit enter again.

Thanks,

mikeburg


[VBA]
Sub WTurnOnCtrlEnter()
'Turns on control + enter
Application.OnKey "^~", "YDefaultMacro"
End Sub
Sub YDefaultMacro()
ActiveCell.Offset(0, 0) = ActiveCell.Offset(-1, 0)
End Sub
Sub XTurnOffCtrlEnter()
'Turns off control + enter
Application.OnKey "^~"
End Sub
[\VBA]


--
mikeburg
------------------------------------------------------------------------
mikeburg's Profile: http://www.excelforum.com/member.php...o&userid=24581
View this thread: http://www.excelforum.com/showthread...hreadid=383736

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA code for cursor movement without leaving scroll area


Just add this line

ActiveCell.Offset(1, 0).Select

after your

ActiveCell.Offset(0, 0) = ActiveCell.Offset(-1, 0)


HTH


--
bhofsetz
------------------------------------------------------------------------
bhofsetz's Profile: http://www.excelforum.com/member.php...o&userid=18807
View this thread: http://www.excelforum.com/showthread...hreadid=383736

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA code for cursor movement without leaving scroll area


ActiveCell.Offset(0, 0) = ActiveCell.Offset(-1, 0) carries the curso
outside the set scroll area.

Any other ideas

--
mikebur
-----------------------------------------------------------------------
mikeburg's Profile: http://www.excelforum.com/member.php...fo&userid=2458
View this thread: http://www.excelforum.com/showthread.php?threadid=38373

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA code for cursor movement without leaving scroll area


What is your scroll area?

The way I read you post is that you have the cursor in cell A2 and when
you hit enter you want the value from cell A1 to be copied to A2 and
then the cursor to move to A3.

If that is the case this should work.

Sub YDefaultMacro()
ActiveCell.Offset(0, 0) = ActiveCell.Offset(-1, 0)
ActiveCell.Offset(1, 0).Select
End Sub


--
bhofsetz
------------------------------------------------------------------------
bhofsetz's Profile: http://www.excelforum.com/member.php...o&userid=18807
View this thread: http://www.excelforum.com/showthread...hreadid=383736

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
Cursor Movement Froggy2899 Excel Discussion (Misc queries) 2 August 11th 08 10:54 PM
Cursor Movement? micah Excel Worksheet Functions 10 October 30th 07 04:18 AM
cursor movement crissy Excel Worksheet Functions 3 June 30th 06 09:41 PM
Cursor movement JeffH Excel Discussion (Misc queries) 1 February 23rd 06 09:57 PM
Cursor movement Ann Calantzis Excel Worksheet Functions 1 May 25th 05 04:18 PM


All times are GMT +1. The time now is 12:10 AM.

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

About Us

"It's about Microsoft Excel"