+ Reply to Thread
Results 1 to 3 of 3

Run macro when data in cell is entered

  1. #1
    Registered User
    Join Date
    06-26-2011
    Location
    Dubai
    MS-Off Ver
    Excel 2007
    Posts
    22

    Run macro when data in cell is entered

    Hi all,

    I have to run a macro which is based on the formula A = A - B. I have a 8x3 grid where the columns are Total, Current, Remaining. 'Total' will have details entered by the user initially. 'Remaining' will initially take up values of the 'Total' column. Now I want that when data is entered in 'Current', 'Remaining' should automatically calculate:

    'Remaining' = 'Remaining' - 'Current'

    I tried writing a code in the Worksheet Selection Change window but that just runs the code every time cell selection changes which gives inaccurate results. Is there a way that the formula is calculated only when the data is entered in the cell and the user moves into the other cell? I hope I have been able to express the problem clearly.

  2. #2
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Run macro when data in cell is entered

    Hi vishalgupta,
    I am confused, you want column 'Remaining' to equal the Total column initially, and then you want the 'Remaining' to equal 'Remaining' - 'Current'. I don't think it can be both at the same time. If you could clarify this we will be able to help you better.

    Thanks
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  3. #3
    Registered User
    Join Date
    06-26-2011
    Location
    Dubai
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: Run macro when data in cell is entered

    Hey Mordred,

    The description above was a simplified version of the actual problem. The real problem involves the user entering the number of quantities he wants to be transported. But he will transport them in smaller quantities. So ideally, I want that there should be 3 columns, one which shows the original quantities entered, one to enter quantities to be shipped currently and then the last one showing how much quantities are actually left after all the shipments. That's why 'Remaining' will take up values of 'Total' initially and then its value will be based on the formula.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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