Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
When does TRUE evaluate to minus 1?
I want to exploit the fact TRUE equtes to -1 but cannot get my hea around the conditions surrounding this. I have experimented in cod with MsgBox (5=(50/10)) , or some such direct equality , but each tim simply get the result TRUE. How can I wrest *minus 1* from a TRUE boolean relationship -- david ----------------------------------------------------------------------- davidm's Profile: http://www.excelforum.com/member.php...fo&userid=2064 View this thread: http://www.excelforum.com/showthread.php?threadid=39060 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
When does TRUE evaluate to minus 1?
Convert the bool to and integer CInt(True) = -1 CInt(5=5) = -1 CInt(5=4) = -- TommySzalapsk ----------------------------------------------------------------------- TommySzalapski's Profile: http://www.excelforum.com/member.php...fo&userid=2556 View this thread: http://www.excelforum.com/showthread.php?threadid=39060 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
When does TRUE evaluate to minus 1?
Thanks Tommy. Exactly what I am lookoing for -- david ----------------------------------------------------------------------- davidm's Profile: http://www.excelforum.com/member.php...fo&userid=2064 View this thread: http://www.excelforum.com/showthread.php?threadid=39060 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
When does TRUE evaluate to minus 1?
msgbox "the column is " & _
Left(ActiveCell.Address(0,0), 2 + (ActiveCell.column < 27)) would be an example of exploiting True is equivalent to -1 -- Regards, Tom Ogilvy "davidm" wrote in message ... I want to exploit the fact TRUE equtes to -1 but cannot get my head around the conditions surrounding this. I have experimented in code with MsgBox (5=(50/10)) , or some such direct equality , but each time simply get the result TRUE. How can I wrest *minus 1* from a TRUE boolean relationship? -- davidm ------------------------------------------------------------------------ davidm's Profile: http://www.excelforum.com/member.php...o&userid=20645 View this thread: http://www.excelforum.com/showthread...hreadid=390606 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
When does TRUE evaluate to minus 1?
You can either use CInt to convert it to an integer, or do some
arithmetic with it. E.g. Dim Res As Integer Res = CInt(5 = (50 / 10)) Debug.Print Res ' or Res = (5 = (50 / 10)) + 0 Debug.Print Res -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "davidm" wrote in message ... I want to exploit the fact TRUE equtes to -1 but cannot get my head around the conditions surrounding this. I have experimented in code with MsgBox (5=(50/10)) , or some such direct equality , but each time simply get the result TRUE. How can I wrest *minus 1* from a TRUE boolean relationship? -- davidm ------------------------------------------------------------------------ davidm's Profile: http://www.excelforum.com/member.php...o&userid=20645 View this thread: http://www.excelforum.com/showthread...hreadid=390606 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to change all cells from minus to plus and plus to minus | Excel Worksheet Functions | |||
Search for 2 true arguments and return true or false | Excel Discussion (Misc queries) | |||
CHANGE TRAILING MINUS TO BRACKETS OR PRECEEDING MINUS | Excel Discussion (Misc queries) | |||
Function to return True/False if all are validated as True by ISNU | Excel Worksheet Functions | |||
How do I stop Excel from changing the word true to TRUE? | Excel Discussion (Misc queries) |