addition decimal numbers in listbox error

adelvoira

New Member
Joined
Sep 9, 2017
Messages
35
hello, i have a listbox contains a decimal numbers like 590100,423516 and i want to make an addition of all the lines of my listbox and display it in a textbox
now i'm using this code but it's not working well

here is the code

dim x,i as double
for i =0 to listbox8.listcount - 1
x=x+ listbox8.list(i,3)
next i
textbox75.value= x
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
hello, i have a listbox contains a decimal numbers like 590100,423516 and i want to make an addition of all the lines of my listbox and display it in a textbox
now i'm using this code but it's not working well

here is the code

dim x,i as double
for i =0 to listbox8.listcount - 1
x=x+ listbox8.list(i,3)
next i
textbox75.value= x
Is the comma your decimal point? Why don't you show us maybe 3 or 4 entries from you ListBox and then show us what you want displayed in the TextBox for those values.
 
Upvote 0
https://ibb.co/egrMgb
Yes the comma is the decimal points as shown on the linked picture
and i want to make an addition displayed on the textbox
thank you
Try using this in place of the code you posted in Message #1 ...
Code:
Dim x As Variant, i As Long
For i = 0 To listbox8.ListCount - 1
  x = x + CDec(listbox8.List(i, 3))
Next i
textbox75.Value = x
 
Upvote 0

Forum statistics

Threads
1,223,723
Messages
6,174,121
Members
452,545
Latest member
boybenqn

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top