Thread: What is True ??
View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Jakobshavn Isbrae Jakobshavn Isbrae is offline
external usenet poster
 
Posts: 78
Default What is True ??

Thank you Franz.

I did not know the booleans had different number values in VBA.

Thanks again
--
jake


"Franz Verga" wrote:

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