+ Reply to Thread
Results 1 to 11 of 11

vba macro code for calculating average of all the cols

  1. #1
    Forum Contributor
    Join Date
    07-23-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    106

    vba macro code for calculating average of all the cols

    Dear Sir/ Madam,
    In the given excel file, i need to calculate the average of all the columns and display with the name of average in the last row (where the data ends). For your easy understanding, i have worked out and attached the file for your kind reference.

    please help and do the needful.

    Thank you,

    Regards,
    Dharani.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: vba macro code for calculating average of all the cols

    The attached averages all columns starting from column F.
    Attached Files Attached Files

  3. #3
    Forum Contributor
    Join Date
    07-23-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    106

    Re: vba macro code for calculating average of all the cols

    Quote Originally Posted by AB33 View Post
    The attached averages all columns starting from column F.
    Hello! AB33,

    Thank you so much for your answer for my thread. its working perfectly... thanks a lot... can you please give me the code of this program ???? because like this i have to do for 200 files. from the given excel file i was not able to get the code.

    Thank you for spending your valuable time for this program... looking forward for the reply....

    Regards,
    Dharani.

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: vba macro code for calculating average of all the cols

    The code works with any active sheet

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    07-23-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    106

    Re: vba macro code for calculating average of all the cols

    Quote Originally Posted by AB33 View Post
    The code works with any active sheet

    Please Login or Register  to view this content.
    Hello AB33,

    Thank you for the code.. its perfectly working.. i have a small doubt in this.. this average calculations starts from f col and 5th row, if i need to change these and start from the any other col say b or c or l and 3 row or 2 row respectively, where i have to do changes??? and also, a small modification is required can you modify the code in such way that, the output come with the name of average in the beginning so it will be useful for me for further analysis.?????

    Looking forward for the reply...

    Thank you,

    Regards,
    Dharani.
    Last edited by Dharani Suresh; 02-18-2014 at 02:01 AM. Reason: changing of row and column

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: vba macro code for calculating average of all the cols

    xlPrevious).Row + 1, 6).
    6 is column F

    r5c, 5 between r and c is row 5
    I do not know about your named range as the code does not touch or use it.

  7. #7
    Forum Contributor
    Join Date
    07-23-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    106

    Re: vba macro code for calculating average of all the cols

    in the code could you please tell me what is that """""""""""""".column - 5)."'"""""""""" what it will do???
    I do not know about your named range as the code does not touch or use it. - i could not understand this..... sorry could you please be little more brief.....????

    i asked in the beginning of the average row can i get the name of average so that i can collect that row from all the sheets .

    Thank you.

  8. #8
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: vba macro code for calculating average of all the cols

    Dharani,
    I helped you in the past. I really do not know and understand why you ask people to re-post the code while it has been attached. If you know how to modify a code and know where to find it, why do you ask I should post the code separately?

  9. #9
    Forum Contributor
    Join Date
    07-23-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    106

    Re: vba macro code for calculating average of all the cols

    Quote Originally Posted by AB33 View Post
    Dharani,
    I helped you in the past. I really do not know and understand why you ask people to re-post the code while it has been attached. If you know how to modify a code and know where to find it, why do you ask I should post the code separately?
    Sir / Madam,
    you misunderstood me really i was not able to find the code in your excel sheet which you attached. one way to see the code is to right click on the sheet name and to select view code. but by doing like that also i could not find your code that's y i asked you to re-post the code. after you send me the code separately only i was able to use it for different files and through that only i asked you the doubt. sorry if I irritated you...

    Thank you so much for spending your valuable time for helping me...

    Regards,
    Dharani.

  10. #10
    Forum Contributor
    Join Date
    02-24-2013
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    317

    Re: vba macro code for calculating average of all the cols

    Dharani,
    The code AB33 gave you is in a REGULAR module, it is not in the sheet module.

    When you open the file, click the ENABLE EDITING button. This would be on the yellow bar near the top of the screen. If you don't see the yellow bar, then just go to the next step.

    To find the code, just press ALT + F11

    That brings you to the VBA editor. The code should then be visible. If it isn't, then double click the word "Module 1" in the box on the left of the screen. (Project Window)
    Last edited by Jim885; 02-18-2014 at 08:57 AM.

  11. #11
    Forum Contributor
    Join Date
    07-23-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    106

    Re: vba macro code for calculating average of all the cols

    oh !! Thank you Jim885 for your kind reply... !!!

    Thanks for your tips, now i can find the code as you suggested me..

    Thank you once again for spending your valuable time in helping me...


    Regards,
    Dharani.

+ 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. [SOLVED] Vba macro code for calculating average...
    By Dharani Suresh in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-14-2013, 02:26 AM
  2. Macro error while calculating average
    By rammuruges in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-23-2009, 12:12 PM
  3. Need code for a Filter(rows) then Average(cols) VBA function
    By D3Pratt in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-02-2009, 12:20 PM
  4. Range.Select 1st pass 13 cols, 2nd paqss 25 cols twice as wide in error?
    By Craigm in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-02-2006, 06:04 AM

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