Dim total as Integertotal = 0index = 1N1 = 3000N = 0For index = 1 to N1 total = total + index If total > 3000 Then N = index index = N1 End Ifnext