haemon17
Structural
- Dec 1, 2011
- 5
I'm trying to understand what AND is doing with the integers in the following code. Both a1 and b1 evaluate to TRUE but c1 evaluates to FALSE. Something similar to this code was in a spreadsheet made by someone else.
Any ideas on why some integers return c1=TRUE and others return c1=FALSE??
Sub testand()
Dim a1 As Integer
Dim b1 As Integer
Dim c1 As Boolean
a1 = 12
b1 = 2
c1 = (a1 And b1)
Sheet1.Range("E2").Value = c1
Sheet1.Range("E3").Value = CBool(a1)
Sheet1.Range("e4").Value = CBool(b1)
End Sub
Any ideas on why some integers return c1=TRUE and others return c1=FALSE??
Sub testand()
Dim a1 As Integer
Dim b1 As Integer
Dim c1 As Boolean
a1 = 12
b1 = 2
c1 = (a1 And b1)
Sheet1.Range("E2").Value = c1
Sheet1.Range("E3").Value = CBool(a1)
Sheet1.Range("e4").Value = CBool(b1)
End Sub