+ Reply to Thread
Results 1 to 13 of 13

Excel list box displaying "True" and "False" as '-1' and '0'

  1. #1
    Registered User
    Join Date
    06-12-2012
    Location
    Wichita, Kansas
    MS-Off Ver
    Excel 2010, 2016, 2021-22
    Posts
    87

    Excel list box displaying "True" and "False" as '-1' and '0'

    My list box on my userform is showing TRUE as -1 and FALSE as 0, does anyone know a way I can make it show the actual value of TRUE and FALSE?

    Thanks!!
    Attached Files Attached Files
    Last edited by AliGW; 03-31-2020 at 11:59 AM. Reason: Solved tag added - no need to edit thread title or add solved to post. Thanks.

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Excel list box displaying "True" and "False" as '-1' and '0'

    Hey CM,

    I put a single quote in front of your "True" and made it 'True to try to convert it to text. The clicked the button and "magic" it showed as True instead of -1. I guess Excel thinks "True" is really "-1". Why???
    Can you deal with putting a single quote in front of those "True"?

    Hope this helps. Maybe somebody else will have a better answer.

    Edit: If you use "Done" for True and "Not Yet" for False it shows the full word and means the same.
    Last edited by MarvinP; 03-31-2020 at 11:31 AM.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    06-12-2012
    Location
    Wichita, Kansas
    MS-Off Ver
    Excel 2010, 2016, 2021-22
    Posts
    87
    That works, it just doesn't work with my conditional formatting. I could probably live with that. I've never ran into this problem before. I have another sheet where it works fine.
    Last edited by AliGW; 03-31-2020 at 11:36 AM. Reason: Please don't quote unnecessarily!

  4. #4
    Registered User
    Join Date
    06-12-2012
    Location
    Wichita, Kansas
    MS-Off Ver
    Excel 2010, 2016, 2021-22
    Posts
    87
    You're right. I'll just use "complete" or something. Thanks!!
    Last edited by AliGW; 03-31-2020 at 11:36 AM. Reason: Please don't quote unnecessarily!

  5. #5
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: Excel list box displaying "True" and "False" as '-1' and '0'

    With your code a workaround
    Please Login or Register  to view this content.
    Last edited by nigelog; 04-01-2020 at 06:41 AM.

  6. #6
    Forum Expert BMV's Avatar
    Join Date
    01-13-2020
    Location
    St-Petersburg, Russia
    MS-Off Ver
    2013-2016
    Posts
    1,329

    Re: Excel list box displaying "True" and "False" as '-1' and '0'

    Quote Originally Posted by MarvinP View Post
    I guess Excel thinks "True" is really "-1". Why???
    Becaose TRUE it is Not False . False =0 - not 0 is FFFF because every bit is inverted. FFFF is -1

    Try: Debug.Print Not 0, Hex(Not 0), True And 1
    Last edited by BMV; 03-31-2020 at 12:00 PM.

  7. #7
    Registered User
    Join Date
    06-12-2012
    Location
    Wichita, Kansas
    MS-Off Ver
    Excel 2010, 2016, 2021-22
    Posts
    87
    Thanks for all the help!

  8. #8
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: Excel list box displaying "True" and "False" as '-1' and '0'

    Did you try the code posted above?? Just curious if it works for you there as a bit Heath Robinson
    Attached Images Attached Images

  9. #9
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Excel list box displaying "True" and "False" as '-1' and '0'

    Sometimes True = 1 and sometimes -1. That is why I gave my

  10. #10
    Forum Expert BMV's Avatar
    Join Date
    01-13-2020
    Location
    St-Petersburg, Russia
    MS-Off Ver
    2013-2016
    Posts
    1,329

    Re: Excel list box displaying "True" and "False" as '-1' and '0'

    MarvinP I have neve seen it in VBA but worksheet function it's so.

  11. #11
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Excel list box displaying "True" and "False" as '-1' and '0'

    Here was an old discussion on True is 1 or -1.
    https://www.excelforum.com/excel-gen...worksheet.html

  12. #12
    Registered User
    Join Date
    06-12-2012
    Location
    Wichita, Kansas
    MS-Off Ver
    Excel 2010, 2016, 2021-22
    Posts
    87
    Quote Originally Posted by nigelog View Post
    Did you try the code posted above?? Just curious if it works for you there as a bit Heath Robinson
    It worked great. It's what I went with.

  13. #13
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,643

    Re: Excel list box displaying "True" and "False" as '-1' and '0'

    True =1 in a cell, -1 for vba.
    Recognize as True other than 0(False) for both.
    Please Login or Register  to view this content.
    Last edited by jindon; 04-01-2020 at 02:28 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] IF Statement Evaluates as "TRUE" but Returns "FALSE" Value (Excel 2007)
    By Simcik in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-11-2014, 12:43 PM
  2. Replies: 7
    Last Post: 03-17-2014, 01:51 PM
  3. compare two excel sheets using macros and display the result in "true" or "false"
    By gayunana01 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-09-2012, 07:21 AM
  4. Replies: 5
    Last Post: 10-12-2010, 06:46 AM
  5. Setting values for "TRUE","FALSE" and "#REF!"
    By Hurtige in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-11-2006, 07:31 AM
  6. Replies: 7
    Last Post: 05-13-2006, 05:02 PM
  7. [SOLVED] IF(VLOOKUP("MYDATA", MYNAME, 4) = 0, "TRUE", "FALSE")
    By Souris in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-17-2005, 01:05 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1