![]() |
Convert values in a variant array to integer values
I wish to add up certain values in a variant array (has to be variant, as
data is mixed), to make sure total of these values does not exceed 100. I thought I could simply assign these array values to integer variables and that would work, but it concatenates the numbers (12 + 4 = 124, for instance) instead of adding them. Any ideas how to do this? |
Convert values in a variant array to integer values
Use
dim intAaccumulator as integer 'place this inside your loop to traverse the array if isnumeric(array(counter).value) and instr(".", array(counter).value) = 0 then intAccumulator = intAccumulator + (CInt(array(counter).value) end if "Graham McNeill" wrote: I wish to add up certain values in a variant array (has to be variant, as data is mixed), to make sure total of these values does not exceed 100. I thought I could simply assign these array values to integer variables and that would work, but it concatenates the numbers (12 + 4 = 124, for instance) instead of adding them. Any ideas how to do this? |
All times are GMT +1. The time now is 09:42 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com