My aim is to have the possibility to quickly copy the cell name/cell number of the current cell inside of an Excel file.
Whenever I am on cell XYZ123 (doesn't matter which one), I want to press a key so that this cell name/number
gets stored as an Array element.
It can be stored in Notepad, in Notepad++, wherever.
(In my example I used Notepad++)
So when I do this for 5 cells (marking one at a time), I expect to have them in such a format:
"cell1", "cell2", "cell3", "cell4", "cell5"
Instead of:
cell1cell2cell3cell4cell5
I already found a work-around, which isn't that good, but still works:
Code: Select all
F1::
MouseGetPos, xx, yy ; Get current mouse position
Sleep, 5
Send {lbutton} ; Click inside of the cell
Sleep, 5
MouseMove 111, 153, 0 ; Move cursor to cell name field
Sleep, 5
Send {lbutton} ; Click inside of field
Sleep, 20
Send ^c ; Copy cell name
Sleep, 5
Send {Esc} ; Exit field
Sleep, 5
ControlSend, Scintilla1, ", ahk_class Notepad++ ; Send " character to Notepad++
Sleep, 5
ControlSend, Scintilla1, ^v, ahk_class Notepad++ ; Send copied value to Notepad++
Sleep, 5
ControlSend, Scintilla1, ", ahk_class Notepad++ ; Send " character to Notepad++
Sleep, 5
ControlSend, Scintilla1, `, , ahk_class Notepad++ ; Send , to Notepad++
Sleep, 5
ControlSend, Scintilla1, {Space} , ahk_class Notepad++ ; Send Space character to Notepad++
Sleep, 5
MouseMove, xx, yy, 0 ; Move mouse cursor to original position
return
I can't explain it better.
I'll check your code as well, thanks.
P.S.
Is it possible to split an Array if the list is too big?
Example:
Instead of:
Code: Select all
cellArray := ["B4", "E4", "H4", "H9", "E9", "B9", "B15", "E15", "H15", "H20", "E20", "B20", "B26", "E26", "H26", "H31", "E31", "B31", "K4", "K9", "K14", "K19", "K25", "K30", "P4", "U4", "U9", "U14", "U19", "U30"]
Something like:
Code: Select all
cellArray := ["B4", "E4", "H4", "H9", "E9", "B9", "B15", "E15", "H15", "H20", "E20", "B20", "B26", "E26", "H26",
"H31", "E31", "B31", "K4", "K9", "K14", "K19", "K25", "K30", "P4", "U4", "U9", "U14", "U19", "U30"]
Generally, I have no problem with a big array list.
However, the code gets "fat" just because of an array list.
The rest of the code takes like just half of the screen.
Regards