+ Reply to Thread
Results 1 to 2 of 2

Write VBA Code/Macro for this question.

  1. #1
    Registered User
    Join Date
    08-06-2015
    Location
    Karachi, Pakistan
    MS-Off Ver
    2011
    Posts
    3

    Write VBA Code/Macro for this question.

    You have some data values typed on column A starting from cell A1. You have to create a macro that cumulatively sums the last ‘n’ values provided in column A starting from current row and write the result in corresponding cell of column B. For example, if n=5, then in cell B5 you have to provide sum of values from cell A1 to A5. Similarly in cell B7, the sub should write the sum of values from cell A3 to A7. Essentially the macro shall be providing the sum in cell B5 onwards to include all last ‘n’ values in column A. Unless the number is Column A is ‘5’, in that case, ignore it and do not add it to the sum. Take the input of ‘n’ from the user and make a ‘button’ to launch the macro.
    Please refer to the tab “sum” in the file “Final.xlsx”final.xlsx

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,047

    Re: Write VBA Code/Macro for this question.

    Please take a moment to read the forum rules and then amend your thread title to something descriptive of your problem - not what you think the answer might be. (think google search terms?). Once you have done this please send me a PM and I will remove this request. (Also, include a link to your thread - copy from the address bar)

    Many members search our previous posts, and thread titles play a big part of the search. I doubt anybody would do a search based on your title?

    To change a Title on your post, click EDIT POST then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    (note: this change is not optional )

    Also, this sounds like a homework assignment?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Write Macro Code to Change based on User Choice
    By AStevenG in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-21-2014, 10:25 PM
  2. Can I write macro to change Code in a Userform? If so, how?
    By Prexcel in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-18-2014, 09:39 AM
  3. Situational glitch causes macro failure. Need to write VBA code to correct.
    By ericwilder in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-10-2014, 04:49 PM
  4. [SOLVED] how to write three macro code in single line ?
    By nur2544 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-09-2013, 03:29 AM
  5. Replies: 1
    Last Post: 10-17-2010, 07:11 PM
  6. Macro Question - How to write this code
    By lynv in forum Access Programming / VBA / Macros
    Replies: 1
    Last Post: 05-27-2010, 03:47 PM
  7. [SOLVED] Newbie here: I have a question about a print macro I am trying to write...
    By Kyaba in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-03-2006, 05:45 PM

Tags for this Thread

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