+ Reply to Thread
Results 1 to 3 of 3

Use current value and subtract from multiple cells

  1. #1
    Registered User
    Join Date
    11-01-2018
    Location
    Trondheim, Norway
    MS-Off Ver
    Office 365
    Posts
    4

    Use current value and subtract from multiple cells

    Hey!

    So i just received a new request from somebody to apply some improvements into an Excel document.
    The column "Current bill" changes value throughout the month according to progress on a project.
    When it is time to send a new bill each month that equals to the diffrence between current bill and previously billed, we want to easily put out the amount for each category listed vertically.

    I have no previous experience in writing VBA scripts, which means i need to be feeded any information with a teaspoon.
    What would be the best code build-up in this case?
    Preferrably the buttons "january" to "december" should allow for only one click, until it has been reset by another function.

    To be clear: The code for March/Mars does not work, but is simply an experiment on my part, but you might see what i want to do there.
    The code for February/Februar is not optimal either, i am thinking it should not be necessary with all those lines.

    Feel free to suggest simplifications.

    worksheet.JPG

    Please Login or Register  to view this content.

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,861

    Re: Use current value and subtract from multiple cells

    So let's do a light start and just use looping in columns:

    Please Login or Register  to view this content.
    As you can see the code for March is already done this way, that april and next months coding will be much easier.

    Probably the nexts step (may be I'm wrong) will be making rows variable - this is one of most common tasks and you will find a lot of samples on the forum with variable lastrow as long, or lr as long used
    Best Regards,

    Kaper

  3. #3
    Registered User
    Join Date
    11-01-2018
    Location
    Trondheim, Norway
    MS-Off Ver
    Office 365
    Posts
    4

    Re: Use current value and subtract from multiple cells

    Works like a charm, Thank you!

    It is however quite restricted to any changes, since we will most likely have to add more lines for products in between during the project.

    Also, i need to find a way to calculate every single row, excluding the title cells, but that might be best to to in another thread?
    Please Login or Register  to view this content.

+ 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. How to subtract multiple cells from a signle value
    By JustBringIt in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-06-2016, 10:29 AM
  2. Is there a shortcut key that will subtract multiple cells?
    By cmorten82 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-29-2015, 03:00 AM
  3. Replies: 1
    Last Post: 11-27-2013, 11:15 PM
  4. New to Excel and need help with subtract multiple cells for one cell
    By rpbrown88 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-13-2013, 08:56 PM
  5. [SOLVED] Subtract Dates & Times From Multiple Cells To Get Duration
    By sshot1 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-20-2012, 10:34 AM
  6. Auto subtract 2 values in current row
    By chemoul in forum Excel General
    Replies: 8
    Last Post: 03-29-2010, 08:06 AM
  7. Add and Subtract ranges (with multiple cells) in vba
    By Jon5001 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-03-2005, 02:06 PM

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