+ Reply to Thread
Results 1 to 3 of 3

Addition of ListBox Items

  1. #1
    Registered User
    Join Date
    01-21-2019
    Location
    Australia
    MS-Off Ver
    Office 2018
    Posts
    35

    Addition of ListBox Items

    Hi everyone,

    Probably a pretty simple one, but when I attempt to add the items of two listboxes together, rather than doing an addition of the two values, it instead places them next to each other. That is for my code
    Please Login or Register  to view this content.
    An example of my issue would be that ListBox2.List(i, 1) currently equals "5" and ListBox1.List(ListBox1.ListCount - 1, 1) currently equals "3", instead of the new value for ListBox2.List(i, 1) returning "8", it becomes "53".

    I believe this has something to do with the listbox storing this data as text, rather than a number?

    Thanks for your time!

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,434

    Re: Addition of ListBox Items

    Your assumption is correct. + will act as concatenation for strings

    You can use CDBL of CLNG to treat text as numeric
    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    01-21-2019
    Location
    Australia
    MS-Off Ver
    Office 2018
    Posts
    35

    Re: Addition of ListBox Items

    Perfect solution! Thank you very much!

+ 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] Loop find all matches of listbox items, display results in another listbox
    By banaanas in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-29-2015, 02:56 AM
  2. [SOLVED] How to keep items in ListBox in alphabetical order when removing and adding items to box
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 01-31-2015, 07:13 AM
  3. Listbox, Need to change number of items in List (not the items)
    By Kalithro in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-14-2013, 09:23 PM
  4. [SOLVED] Auto select items in a Listbox with items from another Listbox
    By perducci in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 05-22-2013, 04:45 PM
  5. Copy Selected items from multicolumn, multiselect listbox to another listbox
    By Willigb in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-19-2013, 11:27 AM
  6. Editing listbox items in Dblclick event freezes Excel unless mouse moves over listbox
    By muneebmansoor in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-28-2013, 02:21 PM
  7. Transfer random listbox items to new listbox and then loop through selected items
    By narrowgate88 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-31-2013, 05:58 PM

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