Thread: What is True ??
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default What is True ??

On Thu, 31 Aug 2006 17:13:01 -0700, Jakobshavn Isbrae
wrote:

I run this
Sub macro()
Dim t As Integer
Dim t2 As Integer
t = 1
t2 = (t = 1) * 7
MsgBox (t2)
End Sub

and it says -7, not 7

Why?


From VBA HELP:

"When Boolean values are converted to other data types, False becomes 0 and
True becomes -1."

So your formula reduces to:

t2 = -1 * 7

t2 = -7


--ron