+ Reply to Thread
Results 1 to 7 of 7

auto adjust total amount whenever a new row is added/ deleted

  1. #1
    Registered User
    Join Date
    09-13-2019
    Location
    Perth, Australia
    MS-Off Ver
    2016
    Posts
    19

    auto adjust total amount whenever a new row is added/ deleted

    Hi all,

    i have trouble with my coding where i want to click on a button on my excel file to get the total amount. It keep showing error that my lastrow is empty.

    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor
    Join Date
    12-14-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2007
    Posts
    439

    Re: auto adjust total amount whenever a new row is added/ deleted

    Quote Originally Posted by Vnz View Post
    Sub GetTotal_Click()
    lastrow = Worksheets("Sheet1").Cells(Rows.Count, 15).End(x1Up).Row
    ThisWorkbook.Sheets("Sheet1").Range("O17:O" & lastrow + 1) = Application.WorksheetFunction.Sum(Sheets("Sheet1").Range("O17:O" & lastrow))
    End Sub
    The red character is the cause of the error.

  3. #3
    Valued Forum Contributor
    Join Date
    06-27-2010
    Location
    sYRIA
    MS-Off Ver
    Excel 2013
    Posts
    669

    Re: auto adjust total amount whenever a new row is added/ deleted

    Hi
    Plus
    The sum result should be in a single cell, wright?
    so ThisWorkbook.Sheets("Sheet1").Range("O" & lastrow + 1) =....
    Last edited by mohadin; 09-18-2019 at 12:19 AM.

  4. #4
    Registered User
    Join Date
    09-13-2019
    Location
    Perth, Australia
    MS-Off Ver
    2016
    Posts
    19

    Re: auto adjust total amount whenever a new row is added/ deleted

    Quote Originally Posted by huuthang_bd View Post
    The red character is the cause of the error.
    How do solve this issue? I put x1Up

  5. #5
    Registered User
    Join Date
    09-13-2019
    Location
    Perth, Australia
    MS-Off Ver
    2016
    Posts
    19

    Re: auto adjust total amount whenever a new row is added/ deleted

    Quote Originally Posted by mohadin View Post
    Hi
    Plus
    The sum result should be in a single cell, wright?
    so ThisWorkbook.Sheets("Sheet1").Range("O" & lastrow + 1) =....
    Hi yes, it would be in a single cell.

  6. #6
    Registered User
    Join Date
    09-13-2019
    Location
    Perth, Australia
    MS-Off Ver
    2016
    Posts
    19

    Re: auto adjust total amount whenever a new row is added/ deleted

    Attachment 641864

    I would like to use have the sum auto adjust whenever i add/remove column above

  7. #7
    Valued Forum Contributor
    Join Date
    06-27-2010
    Location
    sYRIA
    MS-Off Ver
    Excel 2013
    Posts
    669

    Re: auto adjust total amount whenever a new row is added/ deleted

    vBulletin Message
    Invalid Attachment specified. If you followed a valid link, please notify the administrator
    since the attachment is not valid would you Please explain in words what you are trying to do with the code
    Last edited by mohadin; 09-18-2019 at 02:14 AM.

+ 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. Wanting formula to adjust if rows are added/deleted
    By lmoffat in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-23-2018, 02:58 PM
  2. How to auto update the macro cell reference when new rows are added or deleted.
    By actualize in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-16-2016, 08:05 AM
  3. [SOLVED] code to auto number rows - that will update when rows are added/deleted
    By dkitzerow in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-12-2015, 10:45 AM
  4. [SOLVED] Need to Make Camera Tool Image Dynamic (Auto resize as data is added/deleted)
    By Steve N. in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-05-2012, 08:51 PM
  5. [SOLVED] Formula to auto calculate total amount at the last row of the day
    By Jeffrey Ting in forum Excel General
    Replies: 7
    Last Post: 07-15-2012, 11:42 PM
  6. Auto add date when data added/modified/deleted in cell.
    By serahkins in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-25-2012, 08:11 AM
  7. how do i have beginning balance take away an amount auto total
    By mlopez728 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-03-2006, 12:10 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