I am writing a code where one of the lines( Range("H5").value = 10 ) should assign a specific value to a specific cell. However it gives me an #VALUE! error on my cell. Here is my code please help!!:
Function TotalAdUnits(Money As Currency, CycleEarning As Integer) As Integer
TapCost = 16
TotalAdUnits = 0
AdUnit = 0
i = 1
Money = Money + CycleEarning
Do While (Money >= TapCost)
Money = Money - TapCost
TotalAdUnits = TotalAdUnits + Range("L1").Offset(i, 0)
TapCost = Range("J2").Offset(i, 0)
Range("H5").value = 10
i = i + 1
Loop
End Function