0
votes

I'm trying to create a couple hotstrings using arrow keys to select cells for the formula that is created.

:*:=concacane::
send =CONCATENATE({right},{right 2},{right 3})
return

The above is the code that I was hoping would work to call the 'CONCATENATE' function and select the three cells to the right of the cell I was typing in. Unfortunately Excel seems to escape the cell I was working in, and I end up with commas and parenthesis spread across a few cells to the right instead of the working formula I was looking for.

I tried using 'sendraw' and adding everything after '=CONCATENATE(' on a second 'send' line hoping that the '=' was some kind of modifier that was messing me up, but that didn't seem to help. I also tried using a key combination instead of a hotstring but I couldn't get that script to do anything at all and a key combination would be less than ideal anyway...

Does anybody have any idea how I can get this to work? Thanks in advance!

2

2 Answers

0
votes

I think this will work once you add spaces around the {right} commands.

:*:cc\:: ; cc\ is shorter for me than =concacane
Send, =CONCATENATE( {right 1} , {right 2} , {right 3} ) {Enter}
Return

Tested this in Excel and it works.

0
votes

this can be done in COM

:*:cc\::
send, {Escape}
XlApp := ComObjActive("Excel.Application")
a := XlApp.ActiveCell.Offset(0,1).Address
b := XlApp.ActiveCell.Offset(0,2).Address
c := XlApp.ActiveCell.Offset(0,3).Address
XlApp.ActiveCell.Offset(0,0).value := "=CONCATENATE(" a "," b "," c ")"
Return