I am trying a simple VBA program, that looks like this:
Function NotWorking() As Single
If Range("C3") = 0 Then
NotWorking = "=0.6*7"
Else
NotWorking = 1.2
End If
End Function
If cell C3 has 0 as a value, the function NotWorking has to return in the current cell the result of *=0.6*7*, which is 4,2. If the value in C3 is not 0, then the current cell has to return 1,2.
In my case, things aren't the way I expected. In the current cell I type =NotWorking(). If C3 is anything but 0, I obtain 1,2, but when I appropriate 0 to C3, the current cell returns #VALUE.
Why does this code not work?
Best regards and thanks in advance!