+ Reply to Thread
Results 1 to 6 of 6

VBA Code to auto copy data from one sheet to another

  1. #1
    Registered User
    Join Date
    07-31-2013
    Location
    Wanganui New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    23

    VBA Code to auto copy data from one sheet to another

    Hi

    I am trying to get a simple code that automaticly copies data to another sheet if I put a W in Column 12 at the moment I am using the code below but I think it is slowing the opening and closing of my spreadsheet has anyone got a better one. If they have I also need a version of it that moves it to another sheet and removes copy on current sheet I have put the 2 examples below.

    Copy Only - If W in colunm 12 copy complete row to sheet 3

    Please Login or Register  to view this content.
    Copy and Delete from orginal- If F in colunm 13 copy to sheet4

    Please Login or Register  to view this content.
    Any ideas or code would be much appricated

    Angela
    Last edited by Angnz; 10-18-2013 at 12:05 AM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2406 Win 11 Home 64 Bit
    Posts
    23,960

    Re: VBA Code to auto copy data from one sheet to another

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    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



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: VBA Code to auto copy data from one sheet to another

    Hi, Angela,

    maybe combnine the two precedures into one like this:
    Please Login or Register  to view this content.
    but I think it is slowing the opening and closing of my spreadsheet
    Are there other events involved or a lot of formulas? AFAIK the mentioned event itself doesn´t have any influence on what you mentioned.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  4. #4
    Registered User
    Join Date
    07-31-2013
    Location
    Wanganui New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: VBA Code to auto copy data from one sheet to another

    Hi Holger

    There is not a lot of formula in the sheets put I am going to open a new workbook and try add each part to see why it is taking a long time to open and close.
    Re your code it looks good but what I didn't tell you was the first piece of code goes in Sheet 1 and the second piece of code goes in the other sheets

    Sheet 1 and that data needs to stay there when I put the W in column 12 and it transfer to Sheet2

    Sheet 2 which I need the data to be there until I put an F in column 13 it moves the data to Sheet3 and deletes from Sheet2

    Sheet3 which I need the data to be there until I put a C in column 14 it moves the data to Sheet 4 and deletes it from Sheet3

    I hope you can understand this.

    Angela

  5. #5
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: VBA Code to auto copy data from one sheet to another

    Hi, Angela ,

    instead fo using Worksheet_Change for this I would think about using Worksheet_Activate-Event for any sheet to trigger the code when that sheet is activated (maybe use a public boolean to see if any change has been made in Sheet1 in order to avoid unnecessary copying/cutting) depending upon if you only need the data for keeping or will work with data from each individual sheet from another part/code.

    Ciao,
    Holger

  6. #6
    Registered User
    Join Date
    07-31-2013
    Location
    Wanganui New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: VBA Code to auto copy data from one sheet to another

    Hi Holger

    I am not that good with codes could you help me with this or tell me which lines I need to changes. Only the data in Sheet 1 the master sheet needs to copy and not delete. Sheet 2 and 3 need to copy the then delete.

    Thanks Angela

+ 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. Auto copy data from one sheet to active sheet
    By rmartin10 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-06-2013, 09:13 AM
  2. Replies: 3
    Last Post: 04-23-2013, 06:49 PM
  3. [SOLVED] macro to auto copy data from multiple sheet to one master sheet
    By roger556 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-30-2012, 01:52 AM
  4. Replies: 3
    Last Post: 06-23-2010, 04:05 PM
  5. Auto copy data from 1 sheet into another
    By Ltat42a in forum Excel General
    Replies: 1
    Last Post: 01-04-2006, 09:55 PM

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