+ Reply to Thread
Results 1 to 4 of 4

Needing a Macro Button to execute Subtraction on Sheet 1 and Addition on Sheet 2

  1. #1
    Registered User
    Join Date
    06-16-2020
    Location
    USA
    MS-Off Ver
    2019
    Posts
    2

    Needing a Macro Button to execute Subtraction on Sheet 1 and Addition on Sheet 2

    Hello,

    So i'm asking for a friend here.

    He's stuck and is basically trying to write the correct code for the VBA Macro Button that executes the following from a single press: Adds a Value in Sheet 2 and Subracts in Sheet 1.

    So for instance he's wanting to Sell Apples.

    -> How much is in Stock: Sheet 1 Apples in stock with Row 1 Column A Cell = 50
    -> Individual that bought some apples: Sheet 2 Buyer with Row 1 Column A Cell = 4

    By increasing the value to 4 in R1CA within Sheet 2, Sheet 1 R1CA would have 46.

    What code or how would the code need to be written in order to execute an action on both sheets simultaneously, but subtracting Sheet 1 and Adding to Sheet 2 (at the same time).

    Can you please advise?

    Any help would be greatly greatly appreciated.



    Friend wanted to also have the following added which is ** * Detrimentally important!! **

    As it is being designed for an office, everything is simple and made of buttons. It needs to be VBA code so that way a Single Button press can execute the action of Subtracting Value from Sheet 1, that was entered in Sheet 2.
    Last edited by LeUnknown; 06-16-2020 at 04:48 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    11-04-2018
    Location
    Denpasar
    MS-Off Ver
    Excel 2010
    Posts
    777

    Re: Needing a Macro Button to execute Subtraction on Sheet 1 and Addition on Sheet 2

    Something like this ?
    Please Login or Register  to view this content.
    The beginning condition (before running the macro) :
    Sheet1 cell A1 has value (for example) 50
    Sheet2 cell A1 no value

    When the macro is run, it ask how many sold.
    If for example the user input 4, then
    Sheet1 cell A1 value become 46
    Sheet2 cell A1 value become 4

    But I don't think is that simple,
    since maybe there are more data, not just one data in cell A1 in a whole sheet .
    Last edited by karmapala; 06-16-2020 at 05:06 PM.

  3. #3
    Registered User
    Join Date
    06-16-2020
    Location
    USA
    MS-Off Ver
    2019
    Posts
    2

    Re: Needing a Macro Button to execute Subtraction on Sheet 1 and Addition on Sheet 2

    Karmapala,

    Thank you very much for your response!
    My friend just tried the code and couldn't believe it that it was exactly what he was trying to accomplish!

    Thanks again for taking the time to write out and explain the code, it was immensely appreciated and believe it or not but my friend was jumping from joy!

    Kind regards and keep safe!

  4. #4
    Valued Forum Contributor
    Join Date
    11-04-2018
    Location
    Denpasar
    MS-Off Ver
    Excel 2010
    Posts
    777

    Re: Needing a Macro Button to execute Subtraction on Sheet 1 and Addition on Sheet 2

    LeUnknown,
    You're welcome.
    Glad I can help .

+ 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 execute a Macro in a downloaded csv sheet?
    By Sree Ram in forum Excel General
    Replies: 1
    Last Post: 02-17-2020, 03:25 AM
  2. [SOLVED] Macro will not execute when called in a different sheet.
    By cudh in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-05-2014, 09:46 AM
  3. Replies: 0
    Last Post: 03-13-2013, 03:14 PM
  4. [SOLVED] Addition of a detailed save button to a sheet
    By cadamhill in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-22-2012, 10:28 PM
  5. [SOLVED] When sheet is activated, execute macro in other sheet and return to sheet
    By timtim89 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-16-2012, 10:50 AM
  6. Help making auto addition/subtraction macro.
    By zx7r in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 01-14-2012, 09:41 PM
  7. Protected Sheet Allows Macro to Execute
    By theSizz in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-27-2010, 02:17 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