我在此功能上收到错误6:Excel 2016 for Mac上的溢出。该错误与stock变量有关,但问题不在于计算股票时,而是在y想要使用它的值或用Debug.Print()
显示时。知道会发生什么吗?
Public row As Integer
Public column As Integer
Public price As Single
Public money As Single
Public stocks As Single
Sub simulateBuys()
stocks = 0
money = 100
' I've reduced the function to be readable, the Call buy() agruments are calculated in other functions
Call buy(29, 6)
' The problem appears here, when i want to use the result calculated in the buy() function
Worksheets("EMA 9 vs 26 Numeros").Cells(4, 4).Value = stocks
End Sub
Sub buy(ByRef row As Integer, ByRef column As Integer)
' In this case, price happens to be 100
price = Worksheets("Price").Cells(row, column).Value
' The division is 100 / 100
stocks = money / price
Debug.Print "done"
End Sub