Forum

Unexpected VBA resu...
 
Notifications
Clear all

Unexpected VBA results. Trying to sum an array

3 Posts
2 Users
0 Reactions
111 Views
(@dmdavala)
Posts: 28
Eminent Member
Topic starter
 

I have a function that populates various arrarys.  At the end I have an array where I want the sum of the values in the array.  This will be the result of the function.

When I test with Debug.print, the Immediate window is populated twice for some reason.  The values are as expected but duplicated.  The result of the function is incorrect.

It is module 3 in the attached.

 
Posted : 29/01/2022 3:59 pm
(@debaser)
Posts: 836
Member Moderator
 

I'm not seeing what you are seeing. In what way are the values incorrect?

 
Posted : 01/02/2022 6:20 am
(@dmdavala)
Posts: 28
Eminent Member
Topic starter
 

I was trying to sum the values of ArrayPresentValueSum by looping through it.

I discovered WorksheetFunction.Sum and switched to that.  Now it works.

 

Thank you for looking at it.

 
Posted : 01/02/2022 10:50 am
Share: