[Solved] What will be the output of the following code in VBA? [closed]


Yes, it will give output of 55. It will loop from k=5 to k=1 and sum will be incremented with the result of k*k in each loop:

sum = 0  + 5 * 5 = 25
sum = 25 + 4 * 4 = 41
sum = 41 + 3 * 3 = 50
sum = 50 + 2 * 2 = 54
sum = 54 + 1 * 1 = 55

To be precise, there will be no output at all, but there will be five popup messages reading:

sum25
sum41
sum50
sum54
sum55

solved What will be the output of the following code in VBA? [closed]