Thread: What is True ??
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Franz Verga Franz Verga is offline
external usenet poster
 
Posts: 459
Default What is True ??

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?


Because in VBA TRUE = -1, while in Excel TRUE = 1, so when you write t=1 its
TRUE and than you multiply TRUE (i.e. -1) times 7...


--
Hope I helped you.

Thanks in advance for your feedback.

Ciao

Franz Verga from Italy