Excel Function problem mit If Schleife
MaxKuba
wisst Ih warum meine Function hier nicht so rechnet wie ich das will? Poblem ist das ich bei der If schleife eine ausnahme eingebaut habe, wenn nicht alle Felder groesser 0 sind dann soll angezeigt werden "NOT ALL CELLS > 0". Leider macht er das auch obwohl alle groesser 0 sind. Meint Ihr das es an Variant liegt?
Gruesse, Max
Public Function APR_PCT( _
PRC_CY As Variant, _
PRC_NY As Variant, _
QTY_NY As Variant, _
PU As Variant)
Dim APR As Variant
If (PRC_CY And PRC_NY And QTY_NY And PU) > 0 Then
APR = (PRC_NY - PRC_CY) * QTY_NY / PU
APR_PCT = APR / (PRC_NY * QTY_NY / PU)
Else
APR_PCT = "NOT ALL CELLS > 0"
Exit Function
End If
End Function
https://www.herber.de/bbs/user/64680.xls