ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   VBA Boolean (https://www.excelbanter.com/excel-discussion-misc-queries/69167-vba-boolean.html)

Jeff

VBA Boolean
 
Hi

In VBA I set

X = (J<15)*8

where J=10, so the statement is true, but "X" is set = to "-8"
if True = 1 why is the 8 negative?

Andy Pope

VBA Boolean
 
Hi,

Because TRUE, in this case, equates to -1
Try this in the immediate window.

?int((10<15))

Cheers
Andy

Jeff wrote:
Hi

In VBA I set

X = (J<15)*8

where J=10, so the statement is true, but "X" is set = to "-8"
if True = 1 why is the 8 negative?


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info


All times are GMT +1. The time now is 10:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com