Excel. I don't get copy A1, then A2, A3, A4....A800 Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Haan
Posts: 12
Joined: 14 Nov 2020, 19:34

Excel. I don't get copy A1, then A2, A3, A4....A800

01 Mar 2021, 10:18

I need help, please.

Problem:
I wanna copy A1 in excel, then, to paste in another program. This i can do.

But, I need, when i press F1 again, the script copy A2, thesn paste in this another progam that I mencioned. After, to copy A3, A4, ...A800, for example

thats the code:

Code: Select all

f1::
Plan1 := ComObjGet("C:\Users\" . A_UserName . "\Desktop\PlanilhaSuporte.xlsx")
A1Val := Plan1.Sheets("Plan1").Cells(1, 1).Value		;----------------------> THAT'S THE PROBLEM. I DON'T KNOW HOW TO COPY THE CELL UNDER, IN CASE A2, THE NEXT TIME I PRESS F1. AND EVERYTIME 
														THAT I  PRESS F1, COPY THE CELL IMMEDIATELY BELOW: A2, A3, A4 .. A800

Clipboard = %A1Val%
Sleep 100
WinActivate PROGRAM 2
Click 122, 61
Send ^v
return
I am thankfull for anyhelp
User avatar
mikeyww
Posts: 26883
Joined: 09 Sep 2014, 18:38

Re: Excel. I don't get copy A1, then A2, A3, A4....A800  Topic is solved

01 Mar 2021, 10:51

Code: Select all

wb := ComObjGet(A_Desktop "\PlanilhaSuporte.xlsx"), n := 0
F1::
Clipboard =
Clipboard := wb.Sheets("Plan1").Cells(++n, 1).Value
ClipWait, 0
If ErrorLevel
 MsgBox, 64, Done, Done!
Else MsgBox, %Clipboard%
Return
Haan
Posts: 12
Joined: 14 Nov 2020, 19:34

Re: Excel. I don't get copy A1, then A2, A3, A4....A800

01 Mar 2021, 11:28

mikeyww wrote:
01 Mar 2021, 10:51

Code: Select all

wb := ComObjGet(A_Desktop "\PlanilhaSuporte.xlsx"), n := 0
F1::
Clipboard =
Clipboard := wb.Sheets("Plan1").Cells(++n, 1).Value
ClipWait, 0
If ErrorLevel
 MsgBox, 64, Done, Done!
Else MsgBox, %Clipboard%
Return
Man.... You are a freaking genius!!! My delay at to answer was because I found some problems in some my script's lines.
Your code is perfect! It was beautiful seen working, changing then A1 to Ax without any problem.
With your help, this script will be help A LOT, you don't have any idea how this is important to me and my others coworkers.
THANK YOU mikeyww
:bravo: :bravo: :bravo: :dance: :dance: :dance: :clap: :clap: :clap: :superhappy: :superhappy: :superhappy: :superhappy: :superhappy:

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Anput, mikeyww and 203 guests