beatified
asked on
AutoHotKey Loop through rows and columns
I would like to loop through columns in Excel via AHK script.
I'm having trouble with the how to call the column and loop to the next column. The goal in the end is to copy cells one at a time and assign a variable to each cell in a row and then loop through that on the following row.
So...
ColumnLoop
B3 Copy to clipboard Paste to Variable appended with A3
C3 Copy to clipboard Paste to Variable appended with A3
through to Column H
RowLoop
Should do the same as above but on Row 4
XL := ComObjActive("Excel.Application")
Columns := Object(1,"A",2,"B",3,"C",4,"D",5,"E",6,"F",7,"G",8,"H",9,"I",10,"J",11,"K",12,"L",13,"M",14,"N",15,"O",16,"P",17,"Q")
For Keys, Value In Columns
Row := 3
Loop, 10
{
XL.Range(????? . Row). Value := "Test" A_Index
}
I'm having trouble with the how to call the column and loop to the next column. The goal in the end is to copy cells one at a time and assign a variable to each cell in a row and then loop through that on the following row.
So...
ColumnLoop
B3 Copy to clipboard Paste to Variable appended with A3
C3 Copy to clipboard Paste to Variable appended with A3
through to Column H
RowLoop
Should do the same as above but on Row 4
ASKER
And here I go trying to reinvent the wheel that is pretty much exactly what I am trying to do again its just been a while since I could work on it.
Yes the only important factor is to have the data in the variable the clipboard can get messy.
Yes the only important factor is to have the data in the variable the clipboard can get messy.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi Stuart,
I'm trying to clean up open questions at EE...this is one of them. Do you need more help with it? Regards, Joe
I'm trying to clean up open questions at EE...this is one of them. Do you need more help with it? Regards, Joe
> I would like to loop through columns in Excel via AHK script.
My AutoHotkey code in one of our previous threads does that:
https://www.experts-exchange.com/questions/28973610/AutoHotKey-vs-Pulover's-Macro-Creator-syntax.html?anchorAnswerId=41824810#a41824810
Let me know if you're able to leverage that code into what you're looking for this time. If not, I'll take a run at it for you, in which case it would be helpful to have a sample input spreadsheet and the output spreadsheet that you want from it (I don't understand your exact requirements from your post). Btw, as a side comment, I'm sure that the clipboard won't be involved...we'll use variables in the AutoHotkey script, not the clipboard. Regards, Joe