SYNTAX VARIABLE RANGE Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
fretaccess
Posts: 8
Joined: 11 Jul 2017, 15:41

SYNTAX VARIABLE RANGE

11 Jul 2017, 15:50

Hi all,

I searched on the forum for a while but didnt find the solution.
I am looping a copy paste process to copy paste cells 100 by 100 in Excel.


To do so I use variables (la and lb) in my Range function, which increase at each loop.
But my syntax must be wrong and I can t get it work. I just find solutions concerning a single cell but never an entire range......

Code: Select all

oExcel.Range("C la :D lb ").Copy

The code is woking without the loop and the variable.



Rest of the code

Code: Select all


WinActivate, Microsoft Excel - ZIPCODE
oExcel := ComObjActive("Excel.Application") ; Automating Excel Application object

;STARTING COPY PASTE PROCESS

j := 1 ; initialization of a counter 
la := 66

Loop, 3
{

	lb := la + 100	
	WinActivate, Microsoft Excel - ZIPCODE

	oExcel.Range("C%la%:D%lb%").Copy ; sTORING copied zipcodes into zipcodes variable

;I dont display the rest of my work
}

TY :)
User avatar
tidbit
Posts: 1272
Joined: 29 Sep 2013, 17:15
Location: USA

Re: SYNTAX VARIABLE RANGE  Topic is solved

11 Jul 2017, 16:49

1) variables don't go in "quotes" when using expressions/functions.
2) variables don't use %'s when using expressions/functions.
3) text does go in "quotes"
3) Range("C" la ":D" lb) is what you need
rawr. fear me.
*poke*
Is it December 21, 2012 yet?
fretaccess
Posts: 8
Joined: 11 Jul 2017, 15:41

Re: SYNTAX VARIABLE RANGE

12 Jul 2017, 09:02

Ok thank you !

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: gongnl, jaka1, mikeyww and 317 guests