Mouse Mover - I made the mouse cursor move automatically with Excel, No more AFK!

Тәжірибелік нұсқаулар және стиль

Never be AFK again with this Mouse Mover!
The cursor moves by itself every specified hours, minutes or seconds. In this video I show you and explain how to move the mouse cursor automatically and periodically with an Excel Visual Basic macro.
Download 32 bit file here: mega.nz/file/fJoh1A6C#Ljygnvd...
Download 64 bit file here:
mega.nz/file/mQpAmJ7a#iZHX3NB...
(Note: File re-uploaded on 5/17/20)
Special thanks to Tim for his suggestion to include the "Sleep 250" instruction near the end of the code to decrease the CPU stress and stop the fans from pumping out heat.
Video shows 32 bit code which may cause an error on some 64 bit systems.
For 64 bit systems change the following:
"Private Declare Function" for "Private Declare PtrSafe Function"
"Private Declare Sub" for "Private Declare PtrSafe Sub"
"Declare Sub" for "Declare PtrSafe Sub"
"Public Declare Function" for "Public Declare PtrSafe Function"
And that will resolve the 64 bit system issue/error, or download the 64 bit version directly.

Пікірлер: 283

  • @dallasdonovan6633
    @dallasdonovan66334 жыл бұрын

    elegant, non-invasive, security-conscious solution...

  • @thepro08

    @thepro08

    3 жыл бұрын

    yes just install random exes from youtube....

  • @glvignesh

    @glvignesh

    3 жыл бұрын

    @@thepro08 its not even an .exe file. Its just an excelsheet

  • @rortiz77

    @rortiz77

    Жыл бұрын

    @@glvignesh which contains a virus or code to download it.

  • @DonGPTO

    @DonGPTO

    Жыл бұрын

    @@rortiz77 Don't download the file, you can always pause the video and type the code by yourself.

  • @rjelsanpedro

    @rjelsanpedro

    4 сағат бұрын

    Do you have a code with automatic left click?

  • @oguifugu6822
    @oguifugu68224 жыл бұрын

    This is brilliant! You're brilliant! Thank you for sharing!!

  • @crosbonit
    @crosbonit3 жыл бұрын

    Very nice, Don. Had to type it manually. Botched several lines, but was able to find the mistakes.

  • @FreddyGaming
    @FreddyGaming Жыл бұрын

    Thank you very much for this! I work from home and my company's laptop is programmed to just lock the screen after 2 mins of inactivity, so this save a lot of hassle!

  • @SameerAhmed-si2sg
    @SameerAhmed-si2sg2 жыл бұрын

    Excellent Don, You're brilliant! Thank you so much for sharing this video!

  • @DonGPTO

    @DonGPTO

    2 жыл бұрын

    My pleasure!

  • @benpochyla728
    @benpochyla7284 жыл бұрын

    Hi Master Don, Great AFK, appreciate your sharing the script and hints. I made it works ! Very helpful for these days stressful times... Keep posting new ideas, please. Stay safe, Ben

  • @DonGPTO

    @DonGPTO

    4 жыл бұрын

    Glad it helped!

  • @xHarpyYTGameplays
    @xHarpyYTGameplays7 жыл бұрын

    Thanks! Greetings from Argentina!

  • @i3k333
    @i3k3333 жыл бұрын

    Amazing! So simple, thank you for sharing!

  • @DonGPTO

    @DonGPTO

    3 жыл бұрын

    You are welcome!

  • @nav33h
    @nav33h4 жыл бұрын

    Thanks a ton Don!

  • @Rubi747HVY
    @Rubi747HVY3 жыл бұрын

    WFH just got a lot better! No more screen lock, Away status, or VPN drop. Thanks

  • @melysandez5008
    @melysandez5008 Жыл бұрын

    Thanks a lot for your file! It will be so helpful 💜

  • @aishwaryaghosh9208
    @aishwaryaghosh92083 жыл бұрын

    Thank you so so much! This is much need during WFH! You are 🔥

  • @DonGPTO

    @DonGPTO

    3 жыл бұрын

    You are so welcome!

  • @shiv.s.jamwal

    @shiv.s.jamwal

    3 жыл бұрын

    It is not working for me, can you guide how did you get it right? I downloaded the 64 bit excel file, ran the macro and it is moving the cursor but system is logging off after sometime and activity isn't getting recorded.

  • @mrbubbles720
    @mrbubbles7202 жыл бұрын

    Thank you so much for sharing this video Don. Liked & subbed.

  • @DonGPTO

    @DonGPTO

    2 жыл бұрын

    Awesome, thank you!

  • @barsraday9531
    @barsraday95313 жыл бұрын

    Pure beauty! Thank you!

  • @DonGPTO

    @DonGPTO

    3 жыл бұрын

    My Pleasure!

  • @neilgore
    @neilgore3 жыл бұрын

    Love your work.. Neat and simple. File download was a bonus.

  • @DonGPTO

    @DonGPTO

    3 жыл бұрын

    Awesome, thank you!

  • @dans6562

    @dans6562

    3 жыл бұрын

    @@DonGPTO where is the file download? New to this..

  • @Ld_277
    @Ld_2773 жыл бұрын

    You are an honest to God lifesaver.

  • @Sophia-wd8tl
    @Sophia-wd8tl3 жыл бұрын

    Amazing! It really works

  • @CelineCarey
    @CelineCarey3 жыл бұрын

    This is neat! Thanks!

  • @oinkpiggin
    @oinkpiggin3 жыл бұрын

    Wow, this is really cool macro. Thanks ! I checked your channel and it seems you are not teaching people about Excel macro. Would you mind sharing where you learnt excel macro ? I would like to improve my skill on this if possible. Thanks in advance.

  • @SMShihanK
    @SMShihanK3 жыл бұрын

    thank you so much for the video

  • @shabnamrashid9633
    @shabnamrashid96332 жыл бұрын

    Thank you for sharing; would you happen to know if this would work when running another macro?

  • @iammesl
    @iammesl3 жыл бұрын

    Thanks!! this is really helpful!

  • @DonGPTO

    @DonGPTO

    3 жыл бұрын

    Glad it was helpful!

  • @Rackmani
    @Rackmani10 ай бұрын

    Excellent - you are a genius! so useful

  • @DonGPTO

    @DonGPTO

    10 ай бұрын

    Glad it was helpful!

  • @nicoleahmed
    @nicoleahmed2 жыл бұрын

    This is brilliant thank you - stops my computer locking whilst I am reading. It would be perfect if numlock was activated twice (to return numlock to original state) or a different key was used (I've seen other programmes use F13). Thanks again

  • @DonGPTO

    @DonGPTO

    2 жыл бұрын

    I'm glad you liked it! ... Numlock is in fact activated twice, this was considered.

  • @firstarnas
    @firstarnas4 жыл бұрын

    Excelent work

  • @taariqkhanoflegend4622
    @taariqkhanoflegend4622 Жыл бұрын

    Works on MS Teams to keep status from resetting. Thanks Don.

  • @chanderpratap6711
    @chanderpratap67113 жыл бұрын

    Very helpful 👍

  • @thedalbofamily
    @thedalbofamily4 жыл бұрын

    Thank you so much!!!

  • @ReduceToAshesEnt
    @ReduceToAshesEnt3 жыл бұрын

    Hey Don, new sub here, love the content!!! I had a question would this work for excel 2010?

  • @DonGPTO

    @DonGPTO

    3 жыл бұрын

    Hi MIC, yes it should work.

  • @978nh4
    @978nh43 жыл бұрын

    Bro you are a genius

  • @neilcarranza1362
    @neilcarranza13622 жыл бұрын

    Hey there kind sir! How can we extend the time that the mouse cursor moves? Or how can we set the "Time to Activate" by half a second? Thanks for your brilliant idea!

  • @michaelgp7535
    @michaelgp75353 жыл бұрын

    Thank you, sir! Much appreciate it! =)

  • @DonGPTO

    @DonGPTO

    3 жыл бұрын

    You're welcome!

  • @balwek2
    @balwek2 Жыл бұрын

    Well Done A bit over complicated I left only the Numlock to have the keystroke, need to increase the time to avoid "sticky key" works fine, it should be work in the background. The Download is a bonus!!!!

  • @avramandrei4910
    @avramandrei49103 жыл бұрын

    Thanks, very helpful

  • @DonGPTO

    @DonGPTO

    3 жыл бұрын

    You're welcome!

  • @mohamedsulaiman9176
    @mohamedsulaiman9176 Жыл бұрын

    Just the best👌👌

  • @dougls2564
    @dougls2564 Жыл бұрын

    Thanks for your time and great videos. I hope you are doing well. I have an excel question. I am entering R or L only for Right or Left in excel (10). That is used in counting and other stuff. But it is very annoying hitting R [enter] L [enter] 50 times. Can you please tell me how to just hit my data (L or R) and not enter and have it enter and go down to the next cell. It would be so much faster and more accurate for me to just hit one letter and have it advance to the next downward cell. Thanks for any help you can give me.

  • @abeks4114
    @abeks41144 жыл бұрын

    I downloaded the file but get the following error message "Compile error: Cannot define a Public user-defined type within an object module" also the following section of the code is highlighted with this error "Public Type POINTAPI" any suggestions?

  • @Felinesuccubus1
    @Felinesuccubus14 жыл бұрын

    This is awesome! i get annoyed when i'm reading work file on paper and my screen keeps locking when i actually need to refer to internet while reading my materials. thanks! but i wonder does it still run if we're also working on word documents? ie, does it run on background?

  • @DonGPTO

    @DonGPTO

    4 жыл бұрын

    Yes it does run while working on word documents.

  • @xlncplays7369

    @xlncplays7369

    4 жыл бұрын

    Just use caffeine software if you can. No need to use excel if its your personal computer

  • @renerivero8691
    @renerivero86914 жыл бұрын

    What code can I add or need to change if I wanted to type 3 short sentences when the mouse starts to move

  • @8055113690
    @80551136903 жыл бұрын

    You are life saver 😁😁

  • @rafaelmmartinez9170
    @rafaelmmartinez91703 жыл бұрын

    If you run this in a VMware, there is any way to run it and keep running when you are out of the virtual machine windows? Great tutorial, thanks!

  • @DonGPTO

    @DonGPTO

    3 жыл бұрын

    I really don't know how excel macros behave in a virtual machine, I've never tried it.

  • @TitanGamingYT.
    @TitanGamingYT.3 жыл бұрын

    Thank u so much ❤️.

  • @DonGPTO

    @DonGPTO

    3 жыл бұрын

    You're welcome 😊

  • @deniserog
    @deniserog3 жыл бұрын

    Hey i wanted to change the code a bit and instead of activating the numlock i would like it to press the 1 and the 2 keys, except when i try to run the code it does not click them

  • @mrw8643
    @mrw86432 жыл бұрын

    "Damn man you're ALWAYS at your computer! Even after hours!?" "What can I say.. I'm a smart.. I mean hard worker" Thank you sir. Works just like the video.

  • @theunderdogjmj
    @theunderdogjmj3 жыл бұрын

    Thank you so much

  • @DonGPTO

    @DonGPTO

    3 жыл бұрын

    You're most welcome

  • @krishnapriya7792
    @krishnapriya77923 жыл бұрын

    brilliant

  • @nikhilgarg8198
    @nikhilgarg81982 жыл бұрын

    Can you please help how can I create this? My organization don't allow me to get files from external source. I have written the whole code in macro but not working. Showing runtime error 9 Subscript out of range

  • @cibeleczarneski3146
    @cibeleczarneski31464 жыл бұрын

    Hello, how are you the macro helped me a lot but I needed to close it at a certain time, because the next macros (spreadsheets) do not open to run while the macro mouse is running, thank you very much

  • @DonGPTO

    @DonGPTO

    4 жыл бұрын

    Hello, you can include the following instruction at the end of the sub before the Loop instruction: If Format(Worksheets("Sheet1").Range("B6").Value, "hh:mm:ss") = "00:00:19" Then End And make sure to update the "certain time" you require in the "00:00:19" as with the way it is written it will end the macro at 19 seconds. You will have something like this at the end: GetCursorPos lngCurPos x2 = lngCurPos.x y2 = lngCurPos.y If Format(Worksheets("Sheet1").Range("B6").Value, "hh:mm:ss") = "00:00:19" Then End Loop End Sub

  • @israel9821
    @israel98217 жыл бұрын

    Debería dar un curso de Excel en general !! ya que es un programa de los mas usados en el trabajo!!

  • @roukine71
    @roukine712 жыл бұрын

    Hi, this orogram worked great for the last 2 years.. but stopped last year.. can you fix..? this happened to other users in the last few days... the lock screens still appear and cursor changes to away after 8-9 minutes again... thanks!

  • @diegor6324
    @diegor63242 жыл бұрын

    I got a run time error “file not found: user 32”. Any advice? Thanks

  • @benpochyla728
    @benpochyla7284 жыл бұрын

    Hello Master IT , I am getting error 438 Is that because I am on laptop with touchpad mouse, even I have attached regular optical mouse to USB port Msg: Object does not support this property or method. Does it require upgrade to 64bit ver ? Thank you Ben

  • @DonGPTO

    @DonGPTO

    4 жыл бұрын

    I am not sure but in the comments you I already addresses the 64bit version.

  • @JayStanLee
    @JayStanLee3 жыл бұрын

    This works great! One question - I thought the code was to press numlock TWICE which would put the setting back to original. It seems to only press numlock once, which is turning on and turning off my numlock every time it is activated. Is there a way to fix this?

  • @DonGPTO

    @DonGPTO

    3 жыл бұрын

    If you look at the code you will see this instruction twice: --> SendKeys "{NUMLOCK}", True

  • @JayStanLee

    @JayStanLee

    3 жыл бұрын

    @@DonGPTO Thanks! I did originally try making the sleep instruction incrementally up to 500 and still no fix. I tried deleting the second line of numlock press to only have one. I also tried adding a third line of numlock press as well. In the end I just deleted the numlock press all together as you recommended. All in all this is still an awesome solution to a minor problem without buying any usb sticks or downloading unsafe programs. Thank you!

  • @rcana5803
    @rcana58034 жыл бұрын

    Thank you for the great tutorial. Where do i download the code please?

  • @DonGPTO

    @DonGPTO

    4 жыл бұрын

    Download file here: mega.nz/file/fJoh1A6C#LjygnvdOqXU8BI6Oes_GSUgnHabAvMnyx4zCoAUX6hQ

  • @rcana5803

    @rcana5803

    4 жыл бұрын

    @@DonGPTO : Thanks!

  • @jhovanalvuelo3580
    @jhovanalvuelo35803 жыл бұрын

    Dear I’m running this on my MacBook Pro but there is an error pop up showing “ error ‘53’ file not found User32” could you please help us to fix it ?

  • @eterofwerlds6433

    @eterofwerlds6433

    3 жыл бұрын

    theres a simple solution which is to just stop using a mac

  • @hkrish26

    @hkrish26

    3 жыл бұрын

    I have the same issue. its not working on macbook pro

  • @FloridaMan213
    @FloridaMan2132 ай бұрын

    I was able to download the file, but when I click RUN it doesn't move cursor. What should I do differently or what am I forgetting? TY in advance!

  • @matthewalkman386
    @matthewalkman3863 жыл бұрын

    PLEASE UPDATE FOR 64 BIT - ERROR - "The code in this project must be updated for use on 64-bit systems. Please review and update Declare statements and then mark them with the PtrSafe attribute."

  • @DonGPTO

    @DonGPTO

    3 жыл бұрын

    Read the comments, I already answered this question.

  • @matthewalkman386

    @matthewalkman386

    3 жыл бұрын

    @@DonGPTO @DonGPTO ERROR - FILE NOT FOUND: USER32 RUNTIME ERROR 53 DOESNT WORK!!!!

  • @oinkpiggin
    @oinkpiggin4 ай бұрын

    I am getting this error "compile error can't find a public user defined type within an object module". It stops at Public Type POINTAPI. Any ideas ? Thanks !

  • @domination686
    @domination6863 жыл бұрын

    Amazing! I have having an issue that after the macro is active and the cursor is moving side to side, it's almost like it is stuck in that motion and cannot move the mouse until I either tab back into excel file or if I am already in the file the double click does work. However, before I regain control of the mouse the excel file does not respond for a few seconds. It also looks like the mouse left click is not activating. Windows 10 Machine x64

  • @domination686

    @domination686

    3 жыл бұрын

    Solved: Mouse move counters I and J are set to high. reduce for the length that suites your needs.

  • @DonGPTO

    @DonGPTO

    3 жыл бұрын

    Nice tweak according to your needs!!

  • @coolhunksumit
    @coolhunksumit Жыл бұрын

    Is there a way to auto click instead of auto move with the help of macro in excel?

  • @joele2857
    @joele28573 жыл бұрын

    thanks!!

  • @DonGPTO

    @DonGPTO

    3 жыл бұрын

    You're welcome!

  • @ganeshnarayan844
    @ganeshnarayan8442 жыл бұрын

    hey getting an error saying macro not avaliable or absent. This is not working in my system. please help

  • @pankajshinde6205
    @pankajshinde62053 жыл бұрын

    This is outstanding codings, Thanks sir Can I have code for only mouse move Seconds Elapsed time only with run macro after completing 10 seconds of not moving mouse cursor?

  • @deesee3622
    @deesee36222 жыл бұрын

    does this help with keeping you active in teams as well?? I tried one macro and it didn't work, teams went on away before the macro finished

  • @DonGPTO

    @DonGPTO

    2 жыл бұрын

    I have not tried it with teams. Check the teams timer for going into away mode and set the macro timer to activate before that time and see if it works.

  • @hjs589
    @hjs589 Жыл бұрын

    I get and error "Run time error 53, file not found user32 , and when I select debug in popup window, it shows it stopped at GetCursorPos lngCurPos

  • @kristiyanmetodiev759
    @kristiyanmetodiev7593 жыл бұрын

    Where it's declared in the code when to stop the execution? I want to make it stop after certain period of time.

  • @DonGPTO

    @DonGPTO

    3 жыл бұрын

    It's not declared anywhere but you can compare the "Total Run Time" counter vs the time you want and if true then "End". (in example below 12:25:00 AM is equal to 25 minutes, 1:38:00 AM is equal to 1 hour and 38 minutes, and so forth) Include new code between Do and DoEvents: Do If Worksheets("Sheet1").Range("B6").Value = "12:25:00 AM" then End End If DoEvents . . .

  • @Epiczzzzz
    @Epiczzzzz3 жыл бұрын

    Hello DonGPTO, thanks for the video. Can you share the 64bit file? the mega is link is no longer valid. thanks again

  • @DonGPTO

    @DonGPTO

    3 жыл бұрын

    Hi Sarf, link to the 64bit file in the description is working I just tried it.

  • @infoanimate8422
    @infoanimate84223 жыл бұрын

    Does this work on prohance tracking software???

  • @user-df6pj3sb8q
    @user-df6pj3sb8q10 ай бұрын

    i wrote it from your clip but i have an error: does not recognize the "function" : SetCursorPos (sais is not defined). Also not sure which one is 1 or L small caps (l) of I. Once u said excel none - so i assume xlnone has L and xlcontinuous is also L :D

  • @stevebognacki9929
    @stevebognacki99292 жыл бұрын

    Is there a work around for a Mac system?

  • @akashchavan07_02
    @akashchavan07_026 ай бұрын

    Most of the time the macro doesn't work the computer gets locked but after unlocking the mouse moves. How to fix

  • @renerivero8691
    @renerivero86914 жыл бұрын

    Hi, I tried your VBA but I am getting an error message. "The code in this project must be updated fo use on 64-bit systems. Please review and update Declare statements and then mark them with PtrSafe attribute". any ideas how the vba need to be updated

  • @DonGPTO

    @DonGPTO

    4 жыл бұрын

    Hi, scroll through the comments I already answered that.

  • @ABlueberryMuffin

    @ABlueberryMuffin

    3 жыл бұрын

    @@DonGPTO why not just post it as its own comment so it is at the top?

  • @mohamedriyaz8380
    @mohamedriyaz83803 жыл бұрын

    I want to know this code working for OpenOffice spreed sheet

  • @sudhasree8217
    @sudhasree82176 жыл бұрын

    It looks good Thank youCan you help me I type the code as it is but, I am getting error "can't execute in break mode""compiler error Loop without do"

  • @DonGPTO

    @DonGPTO

    5 жыл бұрын

    Link to file in the description.

  • @DigitalRiesNL
    @DigitalRiesNL3 жыл бұрын

    I've gotten the code to work and it helps to prevent my screensaver in Windows 7, but Windows 10 just ignores it and goes to screensaver anyway. Am I doing something wrong?

  • @DonGPTO

    @DonGPTO

    3 жыл бұрын

    I actually have it working on Windows 10, not sure why it wouldn't work on your machine. Please try it on a different Windows 10 machine to confirm.

  • @DigitalRiesNL

    @DigitalRiesNL

    3 жыл бұрын

    @@DonGPTO I found an easy alternative, a freeware software program called Caffeine which does the same thing. Thanks anyway 👍🏻

  • @ajaynegi1525
    @ajaynegi15253 жыл бұрын

    Just tied my mouse on the window curtain. Now it moves automatically when the curtain is pushed by air.

  • @chuma-edi129
    @chuma-edi1293 жыл бұрын

    Is that work in the game fps like point blank ?

  • @perrybucsdad2682
    @perrybucsdad26822 жыл бұрын

    It would be nice if it would change the time randomly each cycle so it is not easily predicted, and also it would be nice if it would jiggle the mouse randomly as well (not in a linear left to right or even top to bottom each time the same amount). I've been trying to figure out where I need to include a RND() function in it to make it more random.

  • @paweziemba969
    @paweziemba9694 жыл бұрын

    it does not work on office 2019, eroor: compile error: the code in this project must be updated to use on 64 bit systems. Please rewiev and update Declare statements and then mark them with the PtrSafe attribute. Any help ?

  • @DonGPTO

    @DonGPTO

    4 жыл бұрын

    Scroll through the comments, I've already answered this. Thanks!

  • @IcanCwhatUsay

    @IcanCwhatUsay

    3 жыл бұрын

    @@DonGPTO Put the answer in the description then instead of having us scroll through 10000s of useless comments

  • @DonGPTO

    @DonGPTO

    3 жыл бұрын

    Done

  • @NomadAbhiRD
    @NomadAbhiRD4 жыл бұрын

    Hi Don. For some reason I am unable to download. It says file don't exists

  • @DonGPTO

    @DonGPTO

    4 жыл бұрын

    Hello, I just downloaded it successfully link is working. You may want to try with another computer, Thanks.

  • @kingilluminati1863
    @kingilluminati18633 жыл бұрын

    Any way too reduce the time of mouse movement ...i mean the mouse moves for like 20 -30 sec...i wana reduce it to 5 secs

  • @DonGPTO

    @DonGPTO

    3 жыл бұрын

    Check the "For" loops and reduce the values.

  • @luthergathrow1890
    @luthergathrow18904 жыл бұрын

    I get error: code for this project must be updated for 64 bit systems. Please review and update the declare statements and then mark them with the PtrSafe attribute.

  • @DonGPTO

    @DonGPTO

    4 жыл бұрын

    Hi, Change "Private Declare Function" for "Private Declare PtrSafe Function", "Private Declare Sub" for "Private Declare PtrSafe Sub", "Declare Sub" for "Declare PtrSafe Sub", and "Public Declare Function" for "Public Declare PtrSafe Function". I think that will solve the 64 bit system issue..

  • @renerivero8691

    @renerivero8691

    4 жыл бұрын

    Fantastic

  • @MrNsolis

    @MrNsolis

    2 жыл бұрын

    @@DonGPTO Confirmed, this fixed the 64bit problem!

  • @kerlioclassics6440
    @kerlioclassics64404 жыл бұрын

    can you update for 64 bit versions of excel?

  • @DonGPTO

    @DonGPTO

    4 жыл бұрын

    Hi, Change "Private Declare Function" for "Private Declare PtrSafe Function", "Private Declare Sub" for "Private Declare PtrSafe Sub", "Declare Sub" for "Declare PtrSafe Sub", and "Public Declare Function" for "Public Declare PtrSafe Function". I think that will solve the 64 bit system issue..

  • @matthewalkman386

    @matthewalkman386

    3 жыл бұрын

    @@DonGPTO ERROR - FILE NOT FOUND: USER32 RUNTIME ERROR 53

  • @user-od3dh1nr4c
    @user-od3dh1nr4c4 жыл бұрын

    this bit of code is helpful. however it is causing CPU to do some heavy lifting. check for yourself, bring up the task manager after starting it. while this is running, my computer fans ramp up and started pumping out quite a bit of heat. will post a remedy if i find one.

  • @user-od3dh1nr4c

    @user-od3dh1nr4c

    4 жыл бұрын

    thanks again DonGPTO. without having a Sleep command in the loop it is causing the CPU(s) to run this loop as fast as they can. adding "Sleep 250" slows this loop down so it only runs 4 times per second. would really help people that won't read the comments if you were to update the code in the download.

  • @user-od3dh1nr4c

    @user-od3dh1nr4c

    4 жыл бұрын

    **** to see where i've added it the code is below. 5 lines up from the bottom you'll see it **** Sub MouseMove() Dim lngCurPos As POINTAPI Dim StartTime As Double Dim SecondsElapsed As Double Dim MinutesElapsed As String StartTime = Timer StartTime1 = Timer GetCursorPos lngCurPos x2 = lngCurPos.x y2 = lngCurPos.y Worksheets("Sheet1").Range("B1:B6").Value = "" Worksheets("Sheet1").Range("A1").Value = "Cursor Position" Worksheets("Sheet1").Range("A2").Value = "Time Elapsed" Worksheets("Sheet1").Range("A3").Value = "Seconds Elapsed" Worksheets("Sheet1").Range("A4").Value = "Time Remaining" Worksheets("Sheet1").Range("A5").Value = "Times Activated" Worksheets("Sheet1").Range("A6").Value = "Total Run Time" Worksheets("Sheet1").Range("A7").Value = "Time to Activate" Worksheets("Sheet1").Range("B4").Interior.ColorIndex = xlNone Worksheets("Sheet1").Range("B7").Interior.ColorIndex = 6 Worksheets("Sheet1").Range("A1:B7").Borders.LineStyle = xlContinuous Worksheets("Sheet1").Columns("A").ColumnWidth = 21 Worksheets("Sheet1").Columns("B").ColumnWidth = 15 Worksheets("Sheet1").Columns("B").HorizontalAlignment = xlCenter If Worksheets("Sheet1").Range("B7").Value = "" Then Worksheets("Sheet1").Range("B7").Value = "12:01:00 AM" End If Worksheets("Sheet1").Range("B7").NumberFormat = "hh:mm:ss" SecondsToActivate = Worksheets("Sheet1").Range("B7").Value SecondsToActivate = Hour(SecondsToActivate) * 3600 + Minute(SecondsToActivate) * 60 + Second(SecondsToActivate) counter = 0 Do DoEvents GetCursorPos lngCurPos x1 = lngCurPos.x y1 = lngCurPos.y If x1 x2 Or y1 y2 Then StartTime = Timer Worksheets("Sheet1").Range("B4").Interior.ColorIndex = xlNone End If SecondsElapsed = Round(Timer - StartTime, 2) MinutesElapsed = Format(((Timer - StartTime) - 0.5) / 86400, "hh:mm:ss") Worksheets("Sheet1").Range("B1").Value = "X: " & lngCurPos.x & " Y: " & lngCurPos.y Worksheets("Sheet1").Range("B2").Value = MinutesElapsed Worksheets("Sheet1").Range("B3").Value = SecondsElapsed Worksheets("Sheet1").Range("B4").Value = Format(((SecondsToActivate - SecondsElapsed) + 0.5) / 86400, "hh:mm:ss") Worksheets("Sheet1").Range("B5").Value = counter Worksheets("Sheet1").Range("B6").Value = Format(((Timer - StartTime1) - 0.5) / 86400, "hh:mm:ss") If SecondsElapsed Worksheets("Sheet1").Range("B4").Font.Color = RGB(0, 0, 255) ElseIf SecondsElapsed >= SecondsToActivate * 0.7 And SecondsElapsed Worksheets("Sheet1").Range("B4").Interior.ColorIndex = 6 Worksheets("Sheet1").Range("B4").Font.Color = RGB(0, 0, 255) ElseIf SecondsElapsed >= SecondsToActivate * 0.8 And SecondsElapsed Worksheets("Sheet1").Range("B4").Interior.ColorIndex = 46 Worksheets("Sheet1").Range("B4").Font.Color = RGB(0, 0, 255) ElseIf SecondsElapsed >= SecondsToActivate * 0.9 And SecondsElapsed Worksheets("Sheet1").Range("B4").Interior.ColorIndex = 3 Worksheets("Sheet1").Range("B4").Font.Color = RGB(255, 255, 255) ElseIf SecondsElapsed >= SecondsToActivate * 0.95 Then If SecondsElapsed Mod 2 = 0 Then Worksheets("Sheet1").Range("B4").Interior.ColorIndex = xlNone Worksheets("Sheet1").Range("B4").Font.Color = RGB(255, 0, 0) ElseIf SecondsElapsed Mod 2 0 Then Worksheets("Sheet1").Range("B4").Interior.ColorIndex = 3 Worksheets("Sheet1").Range("B4").Font.Color = RGB(255, 255, 255) End If End If If SecondsElapsed >= SecondsToActivate Then Worksheets("Sheet1").Range("B4").Interior.ColorIndex = xlNone Worksheets("Sheet1").Range("B4").Font.Color = RGB(0, 0, 255) For i = 1 To 500 For j = 1 To 100 SetCursorPos x1 + j, y1 Next j For j = 99 To 0 Step -1 SetCursorPos x1 + j, y1 Next j Next i mouse_event MOUSEEVENTF_LEFTDOWN, 0&, 0&, 0&, 0& Sleep 100 mouse_event MOUSEEVENTF_LEFTUP, 0&, 0&, 0&, 0& Sleep 100 SendKeys "{NUMLOCK}", True Sleep 100 SendKeys "{NUMLOCK}", True Sleep 100 StartTime = Timer counter = counter + 1 End If GetCursorPos lngCurPos x2 = lngCurPos.x y2 = lngCurPos.y Sleep 250 Loop End Sub

  • @DonGPTO

    @DonGPTO

    4 жыл бұрын

    Thanks Tim for this contribution, I tested it and brought down the CPU processing for the macro from 47% to 2%, this is awesome! I will update the download file and repost it.

  • @Rackmani

    @Rackmani

    10 ай бұрын

    @@user-od3dh1nr4c Bravo! - (you mean 3 lines up from the bottom not 5 I guess though)

  • @r2cool986
    @r2cool9863 жыл бұрын

    I keep getting the debug error after running 45 mins. Any words of advice on how to fix it?

  • @DonGPTO

    @DonGPTO

    3 жыл бұрын

    If you are using the 64bit version, try with the 32bit version see if it works better. Not sure why you are getting that error you may want to google it.

  • @kshitizvyas5833
    @kshitizvyas58334 жыл бұрын

    The link provided in description does not work - It says page can't be displayed. Please share correct link.

  • @DonGPTO

    @DonGPTO

    4 жыл бұрын

    It's working I just tried it.

  • @prashantpatil4987
    @prashantpatil49873 жыл бұрын

    Its Working well for puting me online throughout , But in Sapience Buddy software that time is not calculated. Is there any solution on it?????????

  • @DonGPTO

    @DonGPTO

    3 жыл бұрын

    I don't know what Sapience Buddy is, sorry.

  • @anujsingh3926

    @anujsingh3926

    3 жыл бұрын

    @@DonGPTO Sapience buddy is time tracking software used in IT companies to track productivity of employees and your macro code works fine but sapience is not capturing time if you left your system idle

  • @bipinsahal8678
    @bipinsahal86783 жыл бұрын

    I downloaded the file but get the following error message "Compile error : Cannot define a Public user-defined type within an object module" also the following section of the code is highlighted with this error "Public Type POINTAPI" Any suggestions please ?

  • @DonGPTO

    @DonGPTO

    3 жыл бұрын

    Not sure why you are getting this error, you may want to google it to find the answer.

  • @kevinserna7617
    @kevinserna76177 жыл бұрын

    hola, muy util video, saludos de veracruz :)

  • @juarez9705

    @juarez9705

    7 жыл бұрын

    Yo soy de veracruz V:

  • @xeroxb2155
    @xeroxb21553 жыл бұрын

    I downloaded the 64 bit file, but for some reason it does not click on the left mouse button, however, it does move the cursor. After the macro moves the cursor, the cursor turns into a blue circle and Excel doesn't respond for about 5 seconds. Then, it starts the cycle again. Do you know how this can be fixed?

  • @DonGPTO

    @DonGPTO

    3 жыл бұрын

    Left mouse button is working try on another PC to check. To decrease the time the cursor moves modify I and J variables as required, see comment for this in video.

  • @sagarsrivastava8711

    @sagarsrivastava8711

    Жыл бұрын

    Hi, did you find any solution for it? I'm having same issue...the click part is not happening.

  • @luciacataldo2532

    @luciacataldo2532

    Жыл бұрын

    Same guys :( any solution so far?

  • @stevenguyen292
    @stevenguyen2923 жыл бұрын

    Download the file and open in Excel hit the run but got an error. Compile error: The code in this project must be updated for use on 64-bit systems. Please review and update Declare statement and mark them with the PtrSafe attribute. Can anyone help? Thanks

  • @omkarkhanvilkar2139

    @omkarkhanvilkar2139

    3 жыл бұрын

    same issue

  • @karenclark2030

    @karenclark2030

    3 жыл бұрын

    This is an older video

  • @DonGPTO

    @DonGPTO

    3 жыл бұрын

    Check the comments I already answered this question indicating the fix.

  • @DonGPTO

    @DonGPTO

    3 жыл бұрын

    Check the comments I already answered this question indicating the fix.

  • @fgtechtips

    @fgtechtips

    3 жыл бұрын

    @@DonGPTO why dont you update the video description then rather than having all reading all comments ?

  • @JoseReyes-jq1cv
    @JoseReyes-jq1cv3 жыл бұрын

    After a few times that it gets activated, it stops as it kind of "select" the cells and it does not continue to activate unless I press a couple of times the left click of the mouse.

  • @williamphilbin1867

    @williamphilbin1867

    3 жыл бұрын

    after a couple months of success, this started happening to me

  • @JoseReyes-jq1cv

    @JoseReyes-jq1cv

    3 жыл бұрын

    @@williamphilbin1867 just open another excel sheet. Activate the macro and open another excel sheet and leave your mouse on that excel sheet. Problem solved.

  • @williamphilbin1867

    @williamphilbin1867

    3 жыл бұрын

    @@JoseReyes-jq1cv I see what you mean there. that is a nice work around, but my issue is a bit different. after the timer goes off, it will move the mouse until Excel (Not Responding) and then the mouse selects the cell it is hovering over which stops the macro. The macro works on my personal laptop still but all of sudden not on my other

  • @greggwagner3742
    @greggwagner37423 жыл бұрын

    I copied and pasted the code and I am getting a Runtime error 53 - File not found User32. I am going out on a limb that this error is because I am on a mac. Can you confirm? @donGPTO

  • @DonGPTO

    @DonGPTO

    3 жыл бұрын

    I tried it on my wife’s mac and I get the same error. This seems to be an error with windows user32 API which are not compatible with mac. Sorry there’s nothing I can do. You may want to try and google for a possible solution to this, not sure there is.

  • @mogumelo6276
    @mogumelo62763 жыл бұрын

    you can make the mouse do the scroll action?

  • @DonGPTO

    @DonGPTO

    3 жыл бұрын

    Yes, that is also possible.

  • @peterannetteryan91
    @peterannetteryan913 жыл бұрын

    1004I have double checked and have all the correct data yet get an error - unable to set HorizontalAlignment property of the Range class - run-time error

  • @DonGPTO

    @DonGPTO

    3 жыл бұрын

    Try downloading the file and check.

  • @sankalpgupta3836
    @sankalpgupta38362 жыл бұрын

    Hi, i am unable to download file can anyone help me

  • @mrsexylove07
    @mrsexylove073 жыл бұрын

    I got the file but the Marco is not on it so it doesn’t work what am I doing wrong?

  • @DonGPTO

    @DonGPTO

    3 жыл бұрын

    Check video to enable developer tab. File must be saved as is.

  • @KuranIsAFantasyBook
    @KuranIsAFantasyBook Жыл бұрын

    If I reduce to icon the excel page I get a debug error

  • @user-df6pj3sb8q
    @user-df6pj3sb8q10 ай бұрын

    :( i cant dowload aything on my laptop - can i have the script for 64 pls?

  • @nekko4515
    @nekko45152 жыл бұрын

    Got an error compile error loop without do .. first time doing vba can you help please?

  • @DonGPTO

    @DonGPTO

    2 жыл бұрын

    Review the code line by line and you will find the error.

Келесі