View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson[_3_] Jim Thomlinson[_3_] is offline
external usenet poster
 
Posts: 983
Default 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?