HI, sorry if this is really thick, but I'm abit stuck...I have written this piece of code as part of a bigger function:
If Z = 1 Then
SIDE = W - (V / 3600#)
End If
If Z = 2 Then
SIDE = W + (V / 3600#)
End If
If Z = 3 Then
SIDE = W - (V / 3600#)
End If
If Z = 4 Then
SIDE = W + (V / 3600#)
End If
If Z = 5 Then
SIDE = W - (V / 3600#)
End If
If Z = 6 Then
SIDE = W + (V / 3600#)
End If
I know it's a stupid way of doing it, but I tried:
If Z = 1 or 3 or 5 Then
SIDE = W - (V / 3600#)
else
SIDE=W + (V / 3600#)
End If
Could someone please help me to find a neater way of telling it to perform different formula for odd and even numbers?
Interesting, that. I'll do a test project and play with it, and the Iif one.
Have to say though that although I've used Iif before, I found that it didn't cope with complicated logic very well, so I stopped using it even though it meant a few more lines.
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline:hi
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline:Brand new to VB