+ Reply to Thread
Results 1 to 11 of 11

Vba code to copy paste full row if condition is met

  1. #1
    Forum Contributor
    Join Date
    10-30-2019
    Location
    GUJARAT,INDIA
    MS-Off Ver
    MS OFFICE 2016
    Posts
    134

    Vba code to copy paste full row if condition is met

    I want to copy whole row from sheet 'NB' to sheet "DATA'' if column M of sheet 'NB' matches text written in cell "C2" of "BONUS'' sheet. I want to overwrite data in sheet "DATA" every time I run VBA code.

    I will be thankful to you if someone can provide VBA code for above mentioned project.
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    07-14-2017
    Location
    Poland
    MS-Off Ver
    Office 2010
    Posts
    528

    Re: Vba code to copy paste full row if condition is met

    Try.
    Please Login or Register  to view this content.
    Best Regards,
    Maras.

  3. #3
    Forum Contributor
    Join Date
    10-30-2019
    Location
    GUJARAT,INDIA
    MS-Off Ver
    MS OFFICE 2016
    Posts
    134

    Re: Vba code to copy paste full row if condition is met

    Code if working fine. only one problem is Ithat want to overwrite data in sheet "DATA" every time I run VBA code. present code is appending data in sheet"DATA". Every time I have to delete previous data before running vba code.

  4. #4
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: Vba code to copy paste full row if condition is met

    This is another option …

    Please Login or Register  to view this content.
    If I was able to help, you can thank me by clicking the * Add Reputation under my user name

  5. #5
    Valued Forum Contributor
    Join Date
    07-14-2017
    Location
    Poland
    MS-Off Ver
    Office 2010
    Posts
    528

    Re: Vba code to copy paste full row if condition is met

    The corrected code.
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    10-30-2019
    Location
    GUJARAT,INDIA
    MS-Off Ver
    MS OFFICE 2016
    Posts
    134

    Re: Vba code to copy paste full row if condition is met

    Thanks NANKW83 your code is giving desired result.
    Now If I want to copy whole row from sheet 'NB' to sheet "DATA'' if column M of sheet 'NB' matches text written in cell "C2"or
    OR "C3" OR "C4" of "BONUS'' sheet. what changes Ii have to make in present code.

  7. #7
    Forum Contributor
    Join Date
    10-30-2019
    Location
    GUJARAT,INDIA
    MS-Off Ver
    MS OFFICE 2016
    Posts
    134

    Re: Vba code to copy paste full row if condition is met

    sorry Sir, correct question is " If I want to copy whole row from sheet 'NB' to sheet "DATA'' if column M of sheet 'NB' matches text written in cell "C2"and
    and "C3" and "C4" of "BONUS'' sheet. what changes I have to make in present code.

  8. #8
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: Vba code to copy paste full row if condition is met

    Try now …

    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    10-30-2019
    Location
    GUJARAT,INDIA
    MS-Off Ver
    MS OFFICE 2016
    Posts
    134

    Re: Vba code to copy paste full row if condition is met

    Excellent. Thanks a lot. My problem is solved.

  10. #10
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: Vba code to copy paste full row if condition is met

    Glad to help … Please mark this thread as 'SOLVED' & consider giving Reputations to those who have helped by clicking the star under their usernames

  11. #11
    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 copy paste full row if condition is met

    The advanced filter has been devised for this. In the sheet 'BONUS' in C1 type 'AG' and run the following code:

    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. macro code to copy and paste with condition
    By piku9290dgp in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-29-2019, 07:06 AM
  2. VB code to copy and paste with condition
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-29-2017, 12:45 PM
  3. VBA code to copy paste a range based on a condition
    By rshnkmr39 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-18-2014, 04:29 AM
  4. [SOLVED] Code to copy and paste a row into another sheet of the workbook when a condition is met.
    By oldboots in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-09-2013, 03:03 AM
  5. Copy and Paste Full Record from Dropdown List
    By expatbob in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-04-2010, 02:29 PM
  6. Code: Copy and paste based on condition
    By pauldaddyadams in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-25-2010, 10:45 AM
  7. [SOLVED] Unable to copy/paste in Excel once clipboard gets full
    By Sean via OfficeKB.com in forum Excel General
    Replies: 0
    Last Post: 04-26-2006, 06:50 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