Keep the cursor moving

shreeram.maroo
2StarLounger
Posts: 181
Joined: 19 Feb 2016, 16:54
Location: Veraval, India

Keep the cursor moving

Post by shreeram.maroo »

Can there be any macro or a trick where i can keep the cursor moving within the selected cells continously unless I manually interrupt the movement. Let's say in the attached file, i need to keep the cursor moving to E4,E5,E6,F4,F5,F6... loop...

Can this be done throgh any means without me actually keeping on pressing the key ?

Maybe it sounds silly, Reason i am asking this is the laptop logs off when i am into discussion with colleagues for a long time and i need to log on again and again to check the messages and mails.

I know we can change the time within which the laptop can log off when idle, but i don't have admin access to change that.

Thanks in advance
Shreeram
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78236
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Keep the cursor moving

Post by HansV »

I don't think it is a good idea to bypass the security measures imposed by your employer.
Best wishes,
Hans

shreeram.maroo
2StarLounger
Posts: 181
Joined: 19 Feb 2016, 16:54
Location: Veraval, India

Re: Keep the cursor moving

Post by shreeram.maroo »

This does not amounts to bypass the security measures because I am not doing anything which is unauthorized. This is just for my administrative convenience.

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15498
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: Keep the cursor moving

Post by ChrisGreaves »

shreeram.maroo wrote:
23 Dec 2021, 06:10
Can there be any macro or a trick where i can keep the cursor moving
Shreeram, I am inclined to agree with Hans, so explore the code here at your own risk.

Code: Select all

Option Explicit
' Can there be any macro or a trick where i can keep the cursor moving?
Const lngcSecondsInterval As Long = 5
Dim lngRow As Long
Dim lngCol As Long
Sub Macro2()
    ActiveCell.Offset(lngRow, lngCol).Select
    lngRow = -lngRow
    lngCol = -lngCol
    Application.OnTime Now + TimeSerial(0, 0, lngcSecondsInterval ), "Macro2"
End Sub
Sub Macro1()
    lngRow = 1
    lngCol = 1
    Application.OnTime Now + TimeSerial(0, 0, lngcSecondsInterval ), "Macro2"
End Sub

This bit of code should get you started. It is not a complete solution to your stated problem. I developed it in Excel2003.
Try it by single-stepping through Macro1
Cheers
Chris
An expensive day out: Wallet and Grimace

shreeram.maroo
2StarLounger
Posts: 181
Joined: 19 Feb 2016, 16:54
Location: Veraval, India

Re: Keep the cursor moving

Post by shreeram.maroo »

Hi Chris, this is working fine.. Thanks a lot for this.

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15498
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: Keep the cursor moving

Post by ChrisGreaves »

shreeram.maroo wrote:
24 Dec 2021, 08:34
Hi Chris, this is working fine.. Thanks a lot for this.
Good to hear.
What happens if you eliminate "Macro1"? That is, what if I had supplied you with just "Macro2"?
Thanks
Chris

Code: Select all

Option Explicit
' Can there be any macro or a trick where i can keep the cursor moving?
Const lngcSecondsInterval As Long = 5
Dim lngRow As Long
Dim lngCol As Long
Sub Macro2()
    ActiveCell.Offset(lngRow, lngCol).Select
    lngRow = -lngRow
    lngCol = -lngCol
    Application.OnTime Now + TimeSerial(0, 0, lngcSecondsInterval), "Macro2"
End Sub
An expensive day out: Wallet and Grimace

User avatar
SpeakEasy
4StarLounger
Posts: 536
Joined: 27 Jun 2021, 10:46

Re: Keep the cursor moving

Post by SpeakEasy »

>I am not doing anything which is unauthorized

If that is all security are worried about (which it won't be), then surely you can just ask your IT team to up the timeout for you

LisaGreen
5StarLounger
Posts: 964
Joined: 08 Nov 2012, 17:54

Re: Keep the cursor moving

Post by LisaGreen »

Hmmm,

Slows things down but I think you should include DoEvents somewhere to allow a break.

Lisa

User avatar
StuartR
Administrator
Posts: 12577
Joined: 16 Jan 2010, 15:49
Location: London, Europe

Re: Keep the cursor moving

Post by StuartR »

LisaGreen wrote:
26 Dec 2021, 14:51
Slows things down but I think you should include DoEvents somewhere to allow a break.
Probably not necessary as the sub only executes three lines and then ends.
Application.Ontime will allow events to occur before triggering the next iteration.
StuartR