+ Reply to Thread
Results 1 to 10 of 10

VBA Code to transfer Data From One Worksheet To Another Worksheet

  1. #1
    Forum Contributor
    Join Date
    05-14-2011
    Location
    London, England
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    120

    VBA Code to transfer Data From One Worksheet To Another Worksheet

    Dear All,

    Please, I need help with a vba code to transfer a record from a worksheet (database) to another worksheet which serves as an Archive database.

    We currently use a userform to add into, and lookup records in the main database. However, from time to time, we may wish to make a copy of an individual's record which is in the main database and store the copy in the Archive database. We therefore require a vba code that will enable us to copy an individual's entire record (i.e. each row of the database) into the next empty row of the Archive database. The main database is Sheet1 and the Archive database is Sheet4.

    I have attached a sample file of a workbook containing the two databases (Main database and Archive database). They are identical in every respect. Just require a vba code to copy a record from the main database to the Archive database whenever it is necessary.

    Thanks for your kind help.

    Buddy
    Attached Files Attached Files
    Last edited by Buddy8; 07-22-2016 at 11:24 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    06-29-2014
    Location
    Australia
    MS-Off Ver
    MSO 365
    Posts
    1,095

    Re: VBA Code to transfer Data From One Worksheet To Another Worksheet

    Hello Buddy8,

    Try the following code in a standard module:-


    Please Login or Register  to view this content.
    Attached is your sample file with the code implemented. On the Database sheet, I have created a search box in cell A2. Type a (first)name from Column C into the box (case insensitive) and the relevant row of data will be transferred to the Archive sheet. I have also assigned the macro to the DataBase tag at the top of the page so it is now actually a button from where you can run the code. Click on the button after typing a name in the search box.

    I hope that this helps.

    Cheerio,
    vcoolio.
    Attached Files Attached Files

  3. #3
    Forum Expert
    Join Date
    11-26-2013
    Location
    Colac, Victoria, Australia
    MS-Off Ver
    Excel 2016
    Posts
    1,309

    Re: VBA Code to transfer Data From One Worksheet To Another Worksheet

    Hi Buddy,

    Not sure how you want to trigger the VBA, but this macro will copy the row of the "Active Cell". So just select anywhere on the row and fire the macro, and your row will be copied.

    Please Login or Register  to view this content.
    I hope this helps, please let me know!

    Regards,

    David


    - Please click on the *Add Reputation button at the bottom of helpful responses.

    Please mark your thread as SOLVED:
    - Click Thread Tools above your first post, select "Mark your thread as Solved".


  4. #4
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: VBA Code to transfer Data From One Worksheet To Another Worksheet

    Hi David
    I think there is no need to use Select method
    Please Login or Register  to view this content.
    Would be >>

    Please Login or Register  to view this content.
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  5. #5
    Forum Expert
    Join Date
    11-26-2013
    Location
    Colac, Victoria, Australia
    MS-Off Ver
    Excel 2016
    Posts
    1,309

    Re: VBA Code to transfer Data From One Worksheet To Another Worksheet

    Thanks Yasser - still lots to learn in VBA

    DAC

  6. #6
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: VBA Code to transfer Data From One Worksheet To Another Worksheet

    You're welcome David .. We all seek to learn
    What DAC abbreviation as English in not my native language?
    Regards

  7. #7
    Forum Expert
    Join Date
    11-26-2013
    Location
    Colac, Victoria, Australia
    MS-Off Ver
    Excel 2016
    Posts
    1,309

    Re: VBA Code to transfer Data From One Worksheet To Another Worksheet

    Sorry, DAC are just my initials. David A Coop

  8. #8
    Forum Contributor
    Join Date
    05-14-2011
    Location
    London, England
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    120

    Re: VBA Code to transfer Data From One Worksheet To Another Worksheet

    Thanks to you all - Vcoolio, David and VasserKhalil for your prompt and kind responses, and more importantly, for your help. I have incorporated aspects of your codes to enable me to achieve what I want.

    Again, thanks all for your help.

    Buddy

  9. #9
    Valued Forum Contributor
    Join Date
    06-29-2014
    Location
    Australia
    MS-Off Ver
    MSO 365
    Posts
    1,095

    Re: VBA Code to transfer Data From One Worksheet To Another Worksheet

    Hello Buddy,

    You're welcome. Glad that we were able to help.

    Cheerio,
    vcoolio.

  10. #10
    Valued Forum Contributor
    Join Date
    04-01-2015
    Location
    The Netherlands
    MS-Off Ver
    2003/2007/2010/2016/office 365
    Posts
    880

    Re: VBA Code to transfer Data From One Worksheet To Another Worksheet

    Alternatively, you can use BeforeDoubleClick.

    Please Login or Register  to view this content.

+ 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. Replies: 13
    Last Post: 10-05-2015, 08:59 AM
  2. Replies: 5
    Last Post: 09-30-2014, 07:00 PM
  3. [SOLVED] Transfer Userform data on 1 worksheet to different worksheet (empty row = wrong sheet)
    By HeyInKy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-26-2014, 10:08 AM
  4. Need Help Creating A Macros To Transfer Data From Worksheet to Worksheet
    By rodtay5283 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-27-2014, 02:11 AM
  5. Data transfer from worksheet to worksheet
    By Clayton27 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-09-2012, 06:07 PM
  6. [SOLVED] Code to transfer userform info to worksheet
    By Masquerader1973 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-03-2012, 09:53 AM
  7. Transfer entities from rows/column of one worksheet to another worksheet
    By Thulasiram in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-26-2006, 06:35 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