VBA - SendKeys"输入" Mac Excel 2011的替代方案

时间:2017-06-24 04:08:55

标签: excel vba macos

我试图在Excel中运行包含以下VBA代码的宏:

Range("Results").ClearContents
For counter = 1 To 40
        Range("constant") = -0.04 + counter * 0.005
        Solve
        Application.SendKeys ("{Enter}")
        Range("Results").Cells(counter, 1) = ActiveSheet.Range("constant")
        Range("Results").Cells(counter, 2) = ActiveSheet.Range("portfolio_sigma")
        Range("Results").Cells(counter, 3) = ActiveSheet.Range("portfolio_mean")
        Range("Results").Cells(counter, 4) = ActiveSheet.Range("x_1")
        Range("Results").Cells(counter, 5) = ActiveSheet.Range("x_2")
        Range("Results").Cells(counter, 6) = ActiveSheet.Range("x_3")
        Range("Results").Cells(counter, 7) = ActiveSheet.Range("x_4")
Next counter

在运行时,我收到一条错误,指出SendKeys在Excel for Mac上不可用。对此最有效的替代方案/解决方法是什么?

1 个答案:

答案 0 :(得分:1)