+ Reply to Thread
Results 1 to 8 of 8

Autosum function in code

  1. #1
    Registered User
    Join Date
    09-24-2022
    Location
    London
    MS-Off Ver
    Microsoft Office 2019
    Posts
    70

    Autosum function in code

    Hello - I am trying to autosum with the help of code.
    I want to autosum of Jan, Feb, Mar, Total Expenses with the help of code.


    Attached file
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,835

    Re: Autosum function in code

    Try
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    09-24-2022
    Location
    London
    MS-Off Ver
    Microsoft Office 2019
    Posts
    70

    Re: Autosum function in code

    Thank you so much sir.

    Sir, how to autosum of TOTAL EXPENSES as well ?

    Attach image :

    Attachment 798828

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,835

    Re: Autosum function in code

    Change -3 to -2
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    09-24-2022
    Location
    London
    MS-Off Ver
    Microsoft Office 2019
    Posts
    70

    Re: Autosum function in code

    Thank you so much sir.

    Sir, please explain If condition code ?

    like :

    If ws.[a1] = "Division" Then
    With ws.[a1].CurrentRegion
    x = ws.Evaluate("max(if(" & .Columns(1).Address & "<>"""",row(" & .Address & ")))")

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,835

    Re: Autosum function in code

    My guess was that you may have other worksheet(s) unrelated to this process, so the code will look at A1 ad if A1 is "Division" then add a row to sum.

    Just my guess...

  7. #7
    Registered User
    Join Date
    09-24-2022
    Location
    London
    MS-Off Ver
    Microsoft Office 2019
    Posts
    70

    Re: Autosum function in code

    Yes, you are correct. It autosum of all worksheets.

    Thank you so much sir. it is very helpful.

  8. #8
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,835

    Re: Autosum function in code

    You are welcome and thanks for the rep.

+ 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] Sum Random Number of Rows; Equivalent of AutoSum Function in Code
    By KMVKMVKMV in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-14-2018, 07:09 AM
  2. [SOLVED] Sub Grouped Autosum Function
    By joshuarobbins in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-25-2015, 05:35 PM
  3. autosum function within a formula?
    By henrim in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-22-2013, 12:52 PM
  4. Autosum function in a Macro
    By Cambop in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-25-2012, 08:45 AM
  5. add autosum to this piece of code
    By daillest319 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-24-2012, 02:57 AM
  6. Nested if-function - autosum
    By vvorland in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-18-2008, 09:06 AM
  7. [SOLVED] Autosum function
    By Frankie in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-24-2006, 10:55 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