2
1
I'm making a worksheet where the wind speed defines the potential energy of the location. This value is the basis of a few sheets in the same Excel file. I'm trying to write a code that where I10
is the wind speed and I12
is the potential kWh on that location. I want both I10
as I12
to be input cells where you can either say: I want to know what wind speed I need to generate 4000 kwh i.e. or my wind speed is 4.2 m/s what will my potential energy be?
This is what I made so far, but I don't get the power function to work. At the moment I defined the cell I12
(The kWh's) without VBA as =(2208,5/(54,872))*I10^3
where I10
is the windspeed.
VBA code behind sheet which doesn't work:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Address = "$I$10" Or Target.Address = "$I$12" Then
WIND = Range("I10")
KWH = Range("I12")
Application.EnableEvents = False
If Target.Address = "$I$10" Then
Range("I12").Value = (2208.5 / (54.872)) POWER(WIND,3)
Else
Range("I10").Value = POWER( KWH (2208.5 / (54.872)),(1/3)
End If
End If
Application.EnableEvents = True
End Sub
Potential solution, but not working at the moment.
Function MyPower(Number As Double, Exponent As Double) As Double
MyPower = Number ^ Exponent
End Function
POWER
isn't being called correctly. – Raystafarian – 2014-01-13T13:48:06.353