+ Reply to Thread
Results 1 to 6 of 6

Code overwrite when copy row but need also to add a new row.

  1. #1
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Code overwrite when copy row but need also to add a new row.

    Hi I have below code which work fine. It update in sheet3. So if there is a match in the numbers in Column B sheet2 with Column B sheet3 it copy the row and overwrite the new info in Sheet 3, in the row with the same number.. That is all good. But i need the code also if it dont find a match. Means the number in Column B Sheet2 is not in Sheet3 i would like it to copy this row to the last row in sheet 3 . As a new row. Please if have a look at below code and how do i add the last function in this code.
    Thanks in advance.
    Sincerely
    Abjac

    My present code for overwrite.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,820

    Re: Code overwrite when copy row but need also to add a new row.

    Try:
    Please Login or Register  to view this content.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  3. #3
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Code overwrite when copy row but need also to add a new row.

    HI Mumps1 and thanks for the answer. The code just tried not working. It run nearly 10 seconds and the outfall is that it copy over the row in B7 Sheet3
    I tried change example name in Sheet2 column C but it dont copy over. The first code find the match and overwrite the row in Sheet3.- Which is good. I made a line in Sheet2 with id Company id number in Column B38 but its not working. I need when it find the match, it has to overwrite the rows with same id number in column B both sheets, so overwrite in Sheet3. just like the first code do and then after if no match for the Company id number, it has to copy this row over in the first free row from the buttom in Sheet3 I attached a test sheet you can play with also.
    Try have a look and maybe send a working sheet back.
    Sincerely Abjac
    Attached Files Attached Files

  4. #4
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,820

    Re: Code overwrite when copy row but need also to add a new row.

    Try this version. It uses arrays to speed data processing. If you have a very large data set, looping will be very slow.
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Code overwrite when copy row but need also to add a new row.

    Hi Mumps1 . I just checked it it works what ever i try. If i change it over write. If new rows with new company id number it add them. This code is just brilliant and really usefull for me- Thanks alot- very appriciated.
    Sincerely Abjac

  6. #6
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,820

    Re: Code overwrite when copy row but need also to add a new row.

    You are very welcome.

+ 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. [SOLVED] Help with a vba code to overwrite cell data
    By Zimmerman in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-06-2016, 11:45 AM
  2. [SOLVED] VBA Code to NOT Overwrite file
    By wolfdemon710 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-10-2015, 04:36 PM
  3. How to code an overwrite or append via radio button
    By dovermac in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-18-2014, 12:03 PM
  4. [SOLVED] Overwrite A VB code for all users...IF possible?
    By Excelnoub in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-03-2013, 11:46 AM
  5. [SOLVED] Overwrite Thisworkbook code with Macro
    By Fean in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 05-16-2013, 08:27 AM
  6. Code for asking for overwrite YES/NO
    By zyrr in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-25-2012, 09:53 AM
  7. VBA code to overwrite contents of cell
    By laffers in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-24-2011, 01:04 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