Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to change all cells from minus to plus and plus to minus Rockbear Excel Worksheet Functions 4 April 3rd 23 04:28 PM
Search for 2 true arguments and return true or false David Excel Discussion (Misc queries) 3 July 15th 06 10:18 AM
CHANGE TRAILING MINUS TO BRACKETS OR PRECEEDING MINUS Socal Analyst looking for help Excel Discussion (Misc queries) 2 May 12th 06 07:17 PM
Function to return True/False if all are validated as True by ISNU Tetsuya Oguma Excel Worksheet Functions 2 March 15th 06 10:28 AM
How do I stop Excel from changing the word true to TRUE? Schmyerlou Excel Discussion (Misc queries) 1 November 23rd 05 08:54 PM


All times are GMT +1. The time now is 01:56 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"