+ Reply to Thread
Results 1 to 4 of 4

Excel 2010 - VBA - calculate and Copy paste value upon data entry in another cell

Hybrid View

  1. #1
    Registered User
    Join Date
    03-10-2013
    Location
    Switzerland
    MS-Off Ver
    Excel 2003
    Posts
    5

    Excel 2010 - VBA - calculate and Copy paste value upon data entry in another cell

    Hello all,

    I am seeking support for VBA, I am trying to create VBA code that copies and pastes data value, after data entry in another cell from the same row, I do not have great experience with VBA and so I am struggling to create such a code.

    please have a look to the attached file and picture.

    When entering a mouvement "in" colum C, or mouvement "out" in column D,
    I have a vlookup to a pivot table (with automatic data refresh after each data entry) in separate sheet that gave me the current stock (column E ), this only give me the sum of stock entry minus sum of stock release from the pivot table. .


    I would like to have the stock before and after when adding a quantity in or out (Displayed in Red in table below) Something like:
    Once I enter data in col D or C
    for the same row
    Copy-paste value of stock current (after data entry), in cell stock after.
    Calculate and copy paste value of : stock after+OUT-IN, in cell stock before.


    The vloookup on pivot table will continue to give me the current stock, and the column stock before and stock after, will gave me the stock situation at the moment of the movement (so they should have value only, no formulas)


    I do not want to ask too much, but as i am very limited , can you also kindly write also the "Dim." needed if any,
    My Workbook name is : stock antoine.xlsm
    My Worksheet name is : Stock - Mouvements


    So far the only Macro I have is to update after udpate the pivot table with the following code :



    Private Sub Worksheet_Change(ByVal Target As Range)
    'refresh pivot after any changes in sheet Stock balance
    ThisWorkbook.RefreshAll
    End Sub
    On top of that i would like to have a sometime that prevent me from entering data in the columns C and D, it should be either a "Quantity In" or "Quantity out", something like: If the other cell is not empty then forbid data entry .

    Thank you very much in advance for your help


    Antoine
    Humanitarian worker

    table.png
    Attached Files Attached Files
    Last edited by lantuan; 09-03-2019 at 03:28 PM.

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2504
    Posts
    13,621

    Re: Excel 2010 - VBA - calculate and Copy paste value upon data entry in another cell

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between [CODE] [/CODE] tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    As you are new here I will do it for you this time

  3. #3
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2504
    Posts
    13,621

    Re: Excel 2010 - VBA - calculate and Copy paste value upon data entry in another cell

    Hi and welcome
    although we value privacy as much as anyone else, it could be important that members have a rough idea of your location. You might in the future post questions which are bound to your regional settings.
    So, please update your profile to something more precise then "Groland" ( country will suffice, no need to be more precise).
    Thank you for helping us to help you

  4. #4
    Registered User
    Join Date
    03-10-2013
    Location
    Switzerland
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Excel 2010 - VBA - calculate and Copy paste value upon data entry in another cell

    Thanks Pepe for the welcome, and for adjusting the Tag.
    I have updated my Location.
    Thank you for helping me.

+ 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. [SOLVED] Paste data to another sheet based on cell criteria(s) - VBA Excel 2010
    By magneto_sphere in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-20-2015, 11:40 AM
  2. disable copy/cut/paste/paste special in excel 2010
    By Alina Loredana in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-22-2014, 06:43 PM
  3. How to paste special in Outlook 2010 from a copied cell in Excel 2010
    By Baldowsky in forum Outlook Formatting & Functions
    Replies: 0
    Last Post: 05-30-2014, 11:40 AM
  4. Unable to calculate copy / paste data in Excel
    By ianarman in forum Excel General
    Replies: 1
    Last Post: 04-21-2014, 12:53 AM
  5. copy and paste excel rows based on cell entry
    By camileigh in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-16-2013, 12:05 PM
  6. Replies: 1
    Last Post: 03-13-2013, 02:27 PM
  7. Replies: 0
    Last Post: 07-29-2011, 07:19 AM

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