+ Reply to Thread
Results 1 to 4 of 4

most efficient wat to QUICKLY paste values to another book.

  1. #1
    Forum Contributor
    Join Date
    02-23-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    133

    most efficient wat to QUICKLY paste values to another book.

    Hello,

    For past couple of months, i am learning VBA basics and i figured that often there are more than a couple of ways for getting same results.

    I have few codes from my old workbooks, some are pathetically slow at pasting and some are very efficient.

    I have attached a workbook with 2 sheets. "Master" sheet contains clinical data of patients. 1 row per patient and "clinical" sheet is how report of the patient is generated on an A4 size page.

    I am trying to do the following:

    1. Make a copy of sheet "clinical" at path D:\xyz\xyz\1.xlsx --- 1 being Sr No, serial number of the row as in column A.
    2. Copy (paste special values) contents from master sheet row 1, to 1.xlsx created.
    3. Save file ---> Close.
    4. Create 2.xlsx to paste values from row 2 "master". ---> Save close, 3.xlsx and so on..

    So if i have 500 rows, i will have 500 individual workbooks of patients in a folder named as 1.xlsx,2.xlsx,3.xlsx...and so on..

    --> I want to paste special VALUES only.
    --> Also paste if some cells in a row are empty.
    --> Overwrite if destination file exists.

    In code i use, macro always runs from beginning and recreates all 500 files again. For eg, if i create a new row 501 for new patient and i want to generate only 501.xlsx, my code runs from beginning and creates 500 existing files again. Anyway to paste only selected rows? I can select Sr Nos that are contiguous and macro will only create workbooks for those selected Sr Nos.

    Please Note: In sheet clinical i have already created a table with cell reference. (Where to paste what)

    Some of the slow and efficient codes i was using earlier for other reports are as follows:

    Slow: It's long i have just posted part of the code.

    Please Login or Register  to view this content.
    Code 2 which i use for another report. (Faster and shorter)

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

    Please Login or Register  to view this content.
    All of the above codes do the same job. I don't know how to set the references for my new attached workbook.
    Can anyone help me write codes for attached book?

    Thank you.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: most efficient wat to QUICKLY paste values to another book.

    For Selected Row, so only 1 new file

    Please Login or Register  to view this content.

    For All

    Please Login or Register  to view this content.
    Kind regards
    Leo

  3. #3
    Forum Contributor
    Join Date
    02-23-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    133

    Re: most efficient wat to QUICKLY paste values to another book.

    Thanks Leo,

    Does'nt run. Debug gives error at - Sheets(Sheets.Count).Name = ws1.Range("D" & x)

    I have attached the file.
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: most efficient wat to QUICKLY paste values to another book.

    It does run

    remove data after row 10


    Cheers
    Leo

+ 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. New to VBA- Copy, paste values of worksheet into new work book
    By minimacro in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-09-2014, 04:44 AM
  2. Make Copy/Paste Values Macro more efficient when calculating
    By Phily915 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-22-2014, 04:28 PM
  3. [SOLVED] What is the most efficient way to copy, paste and transpose values between worksheets?
    By fredrs05 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-18-2013, 03:51 PM
  4. More efficient script for insert new worksheets, copy and paste values?
    By SDBoca in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-18-2011, 11:07 AM
  5. Copy and paste values from one work book to another workbook
    By TheAnswer in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-18-2010, 02:57 AM
  6. Paste Special Values-when I paste into the last book
    By christopherj79 in forum Excel General
    Replies: 1
    Last Post: 01-15-2009, 12:03 PM
  7. [SOLVED] What book is the most efficient one to study Excel VBA
    By quekou in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-28-2006, 06: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