+ Reply to Thread
Results 1 to 5 of 5

How to write a macro what asks a integrer interval from a user and finds their sum?

  1. #1
    Registered User
    Join Date
    11-14-2012
    Location
    Estonia
    MS-Off Ver
    Excel 2010
    Posts
    7

    How to write a macro what asks a integrer interval from a user and finds their sum?

    Sub ValueSum()

    Like if gap is between 1 to 5 the sum is = 1+2+3+4+5=15
    Sum is shown to the user.

    Would really need it to be done fast, and would be really grateful for it.

  2. #2
    Registered User
    Join Date
    11-14-2012
    Location
    Estonia
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: How to write a macro what asks a integrer interval from a user and finds their sum?

    Anybody? That sucks if i can't do it in time. :D

  3. #3
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: How to write a macro what asks a integrer interval from a user and finds their sum?

    Try the below code in standard module

    Please Login or Register  to view this content.


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  4. #4
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: How to write a macro what asks a integrer interval from a user and finds their sum?

    How about:

    Please Login or Register  to view this content.
    Gary's Student

  5. #5
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,858

    Re: How to write a macro what asks a integrer interval from a user and finds their sum?

    Hopefully this isn't giving too much away, but this has been asked many times throughout history. The story of a 10 year old Gauss is interesting (assuming it is true).
    1st step in a problem like this is to understand the math behind the problem.

    http://www.ugrad.math.ubc.ca/coursed...tion/sums.html
    http://www.cut-the-knot.org/Curricul...ummation.shtml

    From there, programming a computer to sum the first n integers should be easy.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1