Results 1 to 3 of 3

Thread: Simple adding and subtracting of Cell Values

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2017
    Posts
    24

    Simple adding and subtracting of Cell Values

    Hello all,

    I got this little bit of code I am trying to get to work in my Excel 365 spreadsheet.

    Code:
    ' Put remainder in HZ27
    Remainder = Range("F20").Value - (Range("B32").Value + Range("B35").Value + Range("B41").Value + Range("B46").Value)
    
    LeftOver = Range("HZ27").Value + Remainder
    Range("HW28").Value = "Extra Distribution."
    Range("HX28").Value = LeftOver
    Basically there is a Value in F20 from which I want to subtract the total of the Values in B32+B35+B41+B46 and then stick it in HX28. HX27 gets a value from elsewhere. So HZ27 plus the Remainder goes into HX28. And some informative text goes in HW28.

    But it no workie Can some guru please help this simple homeowner trying to do some budget work in excel and show me how to do this simply mathematical calculation.

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,929

    Re: Simple adding and subtracting of Cell Values

    Thread moved from the 'Application Deployment' forum (which is for questions about installing/distributing apps) to the 'Office Development/VBA' forum (which is where Excel based questions belong)

  3. #3
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Simple adding and subtracting of Cell Values

    But it no workie
    i can not see anything obvious
    you have values in all the cells that are summed?

    can you post a sample workbook (zip first) that demonstrates the issue
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width