我是VBA的新手,我想按Enter键将公式放入数组公式。
所以我将这段代码放入模块中:
Sub matrix()
Dim mySheet As Worksheet
Dim myWorkBook As Workbook
Set myWorkBook = Excel.ActiveWorkbook
Set mySheet = myWorkBook.ActiveSheet
Selection.FormulaArray =
Selection.Formula
End Sub
然后在ThisWoorkbook中输入代码:
Private Sub enter()
Application.OnKey "~", "matrix"
End Sub
但是当我在公式中按“ enter”时,它就会将其放入数组公式中。
你知道为什么吗?
谢谢您的帮助,
Cabouse