none
Reverse a Sum if Required RRS feed

  • Question

  • On my Word UserForm I have three boxes. Sub Total, VAT @ 20% & Grand Total.

    What I would like to happen is that when a user enters a value in Sub Total it adds 20%, displays result in VAT box and then adds to Sub Total which displays in Grand Total.

    What I would like the user to be able to do, should they wish to, is add a value in the Grand Total and then the sum reverses. I know the math on how to do it, I just don't know how to code it to work in either direction. I don't mind a button to 'Reverse Calculate' if needed.

    Any help appreciated

    Toni Chaffin


    Toni Chaffin aka Talisa

    • Moved by Steve Fan Friday, October 4, 2013 2:35 AM code
    Thursday, October 3, 2013 8:29 AM

Answers

  • Hi Toni,

    Given you have a Sub-Total, that implies the possibility of more than one item being involved. If you're going to add a 'Reverse Calculate' function, that means what you'll need is a 'Reverse Calculate' function for every item - not for the Grand Total.

    The trick is to disable whichever input textboxes are not selected whilst the data are being updated, so your code doesn't go off in an endless loop, then re-enable them after they've been updated.


    Cheers
    Paul Edstein
    [MS MVP - Word]

    Friday, October 4, 2013 7:03 AM

All replies

  • Hi,

    This is the forum to discuss questions and feedback for Microsoft Word, I'll move your question to the MSDN forum for Word

    http://social.msdn.microsoft.com/Forums/en-US/home?forum=worddev&filter=alltypes&sort=lastpostdesc

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.

    Steve Fan

    Steve Fan
    TechNet Community Support

    Friday, October 4, 2013 2:44 AM
  • Hi Toni,

    Given you have a Sub-Total, that implies the possibility of more than one item being involved. If you're going to add a 'Reverse Calculate' function, that means what you'll need is a 'Reverse Calculate' function for every item - not for the Grand Total.

    The trick is to disable whichever input textboxes are not selected whilst the data are being updated, so your code doesn't go off in an endless loop, then re-enable them after they've been updated.


    Cheers
    Paul Edstein
    [MS MVP - Word]

    Friday, October 4, 2013 7:03 AM