ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   do I need ScrollArea and/or?? (https://www.excelbanter.com/excel-programming/309279-do-i-need-scrollarea.html)

Andoni[_38_]

do I need ScrollArea and/or??
 
Hi and many thanks in advance!

I am using the following DLL:
Public Declare Function GetAsyncKeyState Lib "user32.dll" (ByVa
nVirtKey As Long) As Integer
Public Const KeyPressed As Integer = -32767
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)


I have the following macro:
Sub Mov_OnTime()
On Error Resume Next
Do
Sleep 10
Select Case KeyPressed
Case GetAsyncKeyState(vbKeyEscape): End
Case GetAsyncKeyState(vbKeyDown): Move_Down
Case GetAsyncKeyState(vbKeyRight): Move_Right
Case GetAsyncKeyState(vbKeyUp): Mov_Change
Case GetAsyncKeyState(vbKeyLeft): Move_Left
Case Else: Move_Down
End Select
DoEvents
Range("A1").Select
Loop
End Sub

so when I press Esc my vba code ends
when I press, vbKeyDown) I call then Move_Down macro


Move_Down ,Move_Right ,Move_Left are made to move a specific Cell t
the right, left and or down
eg:

Sub Move_Right()
If MyBlock(1).Offset(0, 1).Locked = True Then end
MyBlock(1).Cut MyBlock(X).Offset(0, 1)
End Sub

my problem comes because when I press any of this keys without havin
the following "Range("A1").Select" code prior the loop end, see th
macro above
I scroll either down to the right and /or...

So I lose the view of my work after a few Move_Down and or Move_Right
calls

do I have to set up one ScrollArea to avoid this happening an
or?????????


Just let me kno

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 12:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com