我試圖運行在Excel宏包含以下VBA代碼:VBA - 的SendKeys「Enter」鍵替代的Mac的Excel 2011
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不適用於Mac的Excel。什麼是最有效的替代/解決方法?
你爲什麼要回車鍵被按下? –
是的,在「解決」之後,實際打到的「Enter」鍵是什麼?提示框或移動單元格或什麼? – jamheadart
你想做什麼,即下降40行? – anefeletos