+ Reply to Thread
Results 1 to 2 of 2

VBA to copy and paste data in a changing worksheet

  1. #1
    Registered User
    Join Date
    04-26-2019
    Location
    Tacoma, WA
    MS-Off Ver
    Office 365
    Posts
    1

    VBA to copy and paste data in a changing worksheet

    Hello, I am new here and new to VBA.

    Also, have not been on a forum before...

    I am having trouble with a copy and paste function in VBA. I have it set up to automatically run when we open the file; however, the code runs the entire worksheet again making redundant copies of the data.

    What i would like to occur is, when we open the file and the code automatically runs, to only copy and paste only the changes made to the original worksheet.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.


    Capture.JPG

    Thanks in advance!
    Last edited by jeffreybrown; 04-26-2019 at 06:19 PM. Reason: Please use code tags!

  2. #2
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: VBA to copy and paste data in a changing worksheet

    You might want to try using a different event, like Worksheet_Deactivate instead of the Workbook_Open. That way after the changes are made and the worksheet is closed it will call the code to save the changes. To accomplish this, Install the code below in the Worksheet code module of the sheet where you want to save the changes. Right click the sheet name tab, click 'View Code' in the pop up menu, paste the code into the code pane of the vb editor. Close the editor and then double click 'ThisWorkbook' in the Project pane of the editor to open the workbook code module and delete the workbook code. close the vbeditor and click the save button. The code should now run when you leave that workbook page.

    Please Login or Register  to view this content.
    If you mean that you only want the changes to be copied, and pasted then you would need to use Worksheet_Change event that would execute as each change is made. But that event will not recognize changes resulting from Excel calculations.
    Last edited by JLGWhiz; 04-26-2019 at 08:17 PM.
    Any code provided by me should be tested on a copy or a mock up of your original data before applying it to the original. Some events in VBA cannot be reversed with the undo facility in Excel. If your original post is satisfied, please mark the thread as "Solved". To upload a file, see the banner at top of this page.
    Just when I think I am smart, I learn something new!

+ 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. Copy Highlighted Data from Worksheet and Paste to a New Worksheet in another workbook
    By kingsdime29x in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-28-2018, 10:56 PM
  2. [SOLVED] How to copy and paste without changing formula data
    By TnD_Guy in forum Excel General
    Replies: 6
    Last Post: 12-22-2016, 02:50 PM
  3. Replies: 1
    Last Post: 02-18-2013, 11:36 AM
  4. [SOLVED] Copy data from a worksheet and paste to worksheet with a similar worksheet name
    By maacmaac in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-21-2012, 04:02 AM
  5. Copy data from a worksheet and paste to worksheet with a similar worksheet name
    By maacmaac in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-21-2012, 02:49 AM
  6. Copy / Paste Data Based on Changing Criteria
    By ccowman in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-09-2012, 04:47 PM
  7. Prevent changing size when copy&paste into another Excel Worksheet
    By Michelle in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 06-26-2006, 11:35 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