Perhaps someone could help me. I am writing a script, where I need to copy data range every 20 rows from Excel file (column A and B), until there are no filled in rows. Here is what I have so far. I don't know how to create a loop, that would repeat copying from row 21, then 41, then 61 etc., then pasting it into other ERP, and would stop when there are no more data left.
Code: Select all
ex :=ComObjCreate("Excel.Application")
ex.visible := True
ex.Workbooks.Open("C:\Users\Desktop\slice.xlsm")
Sleep 2000
ex.Range("A1:B20").Copy
Sleep 1000
Send, ^v
Send, {Enter 1}
Send, {PgDn 1}
Send, {Down 1}
Sleep, 1000
Thank you
[Mod edit: Moved topic to AHK v1 help, based on posted code.]