+ Reply to Thread
Results 1 to 19 of 19

Code to copy, paste without replacing the existing data

  1. #1
    Registered User
    Join Date
    08-02-2008
    Location
    India
    Posts
    88

    Code to copy, paste without replacing the existing data

    Hello,

    I have two sheets - sheet1 and sheet2. Everytime i run a macro in the sheet1and manually copy the rows from sheet1 {starting (A2:AI2)} and paste as values it in the sheet2 {starting (A2:AI2)}.

    Then I ll delete the available datas in the sheet1 and will run a macro for different customer.

    Again I need to repeat the same action (manually copy and paste the datas to sheet2) without replacing the existing data in the sheet1.

    In simple I require a macro code where it copy the available information in sheet1 and paste it as values in the sheet2 without replacing the existing one.

    I know this is very simple for you people, but not for me:-)

    Thank You!

  2. #2
    Forum Contributor
    Join Date
    01-13-2009
    Location
    Mumbai
    MS-Off Ver
    Excel 2003, 2007
    Posts
    168

    Re: Code to copy, paste without replacing the existing data

    Hi,
    Can you post the sample workbook.

    Regards,
    Vaibhav

  3. #3
    Registered User
    Join Date
    08-02-2008
    Location
    India
    Posts
    88

    Re: Code to copy, paste without replacing the existing data

    I have attached it. I ve hidden few cells to show you the format it looks like (though it doesn't any info).

    I ve already copy, pasted the first set of datas to the sheet2.
    Now I have given some info in the sheet1 which i need to copy,paste in the sheet2 without replacing the existing ones.

    Thank You!
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    08-02-2008
    Location
    India
    Posts
    88

    Re: Code to copy, paste without replacing the existing data

    I have a recorded macro for this.. but it is replacing the existing datas..

    Any help is appreciated..

  5. #5
    Registered User
    Join Date
    08-02-2008
    Location
    India
    Posts
    88

    Re: Code to copy, paste without replacing the existing data

    Anyone find a code for this:-)

    Thank You!

  6. #6
    Registered User
    Join Date
    08-02-2008
    Location
    India
    Posts
    88

    Re: Code to copy, paste without replacing the existing data

    Is this very tough task...
    :-(

  7. #7
    Registered User
    Join Date
    08-02-2008
    Location
    India
    Posts
    88

    Re: Code to copy, paste without replacing the existing data

    can someone help me out with this. I have been trying various ways to do this.. nothing worked out:-(

  8. #8
    Registered User
    Join Date
    08-02-2008
    Location
    India
    Posts
    88

    Re: Code to copy, paste without replacing the existing data

    I Have been trying for this almost a very long time :-(((((

  9. #9
    Valued Forum Contributor
    Join Date
    11-11-2008
    Location
    Euro
    MS-Off Ver
    2007, 2010
    Posts
    470

    Re: Code to copy, paste without replacing the existing data

    Try this code:

    Please Login or Register  to view this content.
    You should change "Sheet1", "Sheet2" to the name of your real-data-file appropriately in this code-lines:
    Please Login or Register  to view this content.
    Last edited by tigertiger; 06-16-2009 at 08:52 AM. Reason: put CODE tag to replace PHP tag

  10. #10
    Registered User
    Join Date
    08-02-2008
    Location
    India
    Posts
    88

    Re: Code to copy, paste without replacing the existing data

    Hi
    Thank u for the code

    I have protected the column A as it contains formulas till cell A100, so it is showing the error message "the column is protected"
    Then I have unprotected the column, then tried running the macro.. Now it is copying the column A alone and pasting it.
    I would like to copy the entire row from A2 to AI2 ans paste in the sheet2 as values

    Column A contains formulas till A100. But the information in Column D2 to AI2 might be lesser than the Column A which contains formulas.
    Randomly I have given the formulas till cell 100

  11. #11
    Valued Forum Contributor
    Join Date
    11-11-2008
    Location
    Euro
    MS-Off Ver
    2007, 2010
    Posts
    470

    Re: Code to copy, paste without replacing the existing data

    Plz, try using the SUB

    Please Login or Register  to view this content.
    Last edited by tigertiger; 06-15-2009 at 11:32 PM. Reason: put CODE tag to replace PHP tag

  12. #12
    Valued Forum Contributor
    Join Date
    11-11-2008
    Location
    Euro
    MS-Off Ver
    2007, 2010
    Posts
    470

    Re: Code to copy, paste without replacing the existing data

    Or an alternative - shorter

    Please Login or Register  to view this content.
    Last edited by tigertiger; 06-15-2009 at 11:33 PM. Reason: put CODE tag to replace PHP tag

  13. #13
    Registered User
    Join Date
    08-02-2008
    Location
    India
    Posts
    88

    Re: Code to copy, paste without replacing the existing data

    Awesome Tiger

    Thank You so much

    :-))))))))))))))))))))))))))))))))))))))))))))))

  14. #14
    Valued Forum Contributor
    Join Date
    11-11-2008
    Location
    Euro
    MS-Off Ver
    2007, 2010
    Posts
    470

    Re: Code to copy, paste without replacing the existing data

    share knowledge
    Please remember to mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

  15. #15
    Registered User
    Join Date
    08-02-2008
    Location
    India
    Posts
    88

    Re: Code to copy, paste without replacing the existing data

    I will do that. But before that I have a small problem in this macro.

    If there is only one line/row. I am getting an error in the line

    Set rDe = shDe.Range("A" & iR & ":AI" & iR).Resize(nR)

    I want this macro to run even if there are no rows or any single row.

    Thanks a lot.

  16. #16
    Registered User
    Join Date
    08-02-2008
    Location
    India
    Posts
    88

    Re: Code to copy, paste without replacing the existing data

    Experts, Any solution for this?

  17. #17
    Registered User
    Join Date
    08-02-2008
    Location
    India
    Posts
    88

    Re: Code to copy, paste without replacing the existing data

    Can anyone help me editing this code?

    Thanks in advance

  18. #18
    Registered User
    Join Date
    08-02-2008
    Location
    India
    Posts
    88

    Re: Code to copy, paste without replacing the existing data

    Can anyone help me out in editing this code?

  19. #19
    Forum Contributor
    Join Date
    06-28-2011
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    115

    Re: Code to copy, paste without replacing the existing data

    still need help? you were asked to mark this thread as solved you didn't

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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