excel - keystroke to enable the cell

Hey all,

Script does:
selects cell A1
copies the formula to cell A1
tries to make it an array (holding down command and pressing return)

Issue:

  1. Right turn this script works except the command and return combo yields nothing since the cell is not selected.

– to enable an array in the cell you have to hold down command key and then press the return key in excel

How to:

  1. How do we select the cell so that the cursor is in the cell?

tell application "Microsoft Excel"
	activate
	set columnFormula to "=SUM((B1:B3<0))"
	--Set formulas to cell
	set the clipboard to columnFormula
	select cell "A1"

	tell application "System Events"
		keystroke "v" using {command down}
		keystroke (click)
		keystroke return key using {command down}
	end tell

end tell


desired result is: {=SUM((B1:B3<0))} assigned to the cell

TIA

Thanks for the information. That is helpful. But the real reason that I’m using the system events, is to enable the array capability unless anyone knows how to applescript that

enabling array.

  1. using the above formula
  2. click the cell to edit the cell
  3. while holding down the command key press the return key
  4. result will be

{=SUM((B1:B3<0))}

please note that there are now curly brackets “{ }” around the formula.

This is the stumbling block i’m having.

Any help would be greatly appreciated.

Thanks that did it. Sorry for not reading it completely