Thread: VBA Excel
View Single Post
Old 10-16-2010, 11:53 AM   #17
Sparks
Scoring Winger
 
Sparks's Avatar
 
Join Date: Dec 2005
Location: Brisbane, Australia
Exp:
Default

^^ Here's my best guess.

Your program doesn't check to see if the integer entered is odd or not, only if it's negative. That might lose you some marks. The way the question is worded is also kind of hard to understand. If I've got it right, it wants you to sum all of the even integers between the (odd, negative) number entered and 121?

I'm not sure how this language works but it seems to me that if you want to do it the way you're doing it, all you want to do is change the for loop to:

For i = mynum + 1 To 121 Step 2

Also, why are sum and i double? They're both always going to be integers. Sum could potentially be a big number, though, so you might want to use a different type (like long) if that exists.

Last edited by Sparks; 10-16-2010 at 12:04 PM.
Sparks is offline   Reply With Quote