I followed a guide to store data from an excel sheet, and store it in different variables using the function count.
The problem is that i want to create new files with the names that are stored in the variables
First count is set to 0, then script sets the cursos on column A and copies wathever is there, then makes a loop where if the clipborad is blank the loop breaks, but there is something stored then creates a variable named ''datapoint%count%'' and adds +1 to the count, and starts the loop again untild finds a blank cell.
My problem is that after that i set count=1, and start a new loop to check until wich variable there is no data stored, if ''datapoint%count%'' = blank, the loop breaks, bu if isnt blank, then uses the function Filecopy to copy a selected file like a template ando copies it to a selected path, but when i try to name it with the data stored in the variable, at the moment of using %count% it doesnt name it the way i intend it.
I know the mistake its the way a try to rename the copied file, but i dont find a solution, so i hope somen can help me.
Here it is the code:
Code: Select all
settitlematchmode, 2
f1::
count=0
Xl := ComObjActive("Excel.Application") ;creates a handle to your currently active excel sheet
Xl.ActiveSheet.Range("a1").select
loop{
send ^c
#HotkeyModifierTimeout, 100
sleep 500
StringReplace, clipboard, clipboard, `r`n,, all
if clipboard =
{
break
}
Else
{
count++
datapoint%count%=%clipboard%
send {down}
}
}
count=1
loop{
if datapoint%count% =
{
break
}
Else
{
FileCopy, C:\Users\tigre\Desktop\Pruebas\ZAPATAS.xlsx, C:\Users\tigre\Desktop\Pruebas\Prueba\%datapoint%count%%.xlsx,
count++
}
}
return
Sorry for the bad grammar, english its no my first lenguage.