+ Reply to Thread
Results 1 to 8 of 8

copy row values to respective sheet if a criteria is met

  1. #1
    Registered User
    Join Date
    09-14-2014
    Location
    new york
    MS-Off Ver
    2010
    Posts
    4

    copy row values to respective sheet if a criteria is met

    is there a VBA code that will accomplish the following requirement:

    Whenever a number is entered in sheet1 ColumnA the VBA checks to see if the number is either 1 or 2 or 3. if the number is 1 then copy all the contents in the row and place them in the next available row in sheet2. if the number is 2 then copy all the contents in the row and place them in the next available row in sheet3. if the number is 3 then copy all the contents in the row and place them in the next available row in sheet4. Also, if i edit "any" of the values in sheet1 that were already copied to sheet2, or sheet3, sheet4, i want the edit to be reflected in the respective sheet. for example, if i edited the "last" value from sheet1 columnA, like change 1 to a 2, i want the last values(row) copied to sheet2 deleted and the correst values entered in sheet3.

    Thanks in advance for your assistance.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,052

    Re: copy row values to respective sheet if a criteria is met

    Does this have to be VBA? Regular formulas could probably do this as well
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    09-14-2014
    Location
    new york
    MS-Off Ver
    2010
    Posts
    4

    Re: copy row values to respective sheet if a criteria is met

    it doesn't have to be VBA, "but" i don't know of any excel formula that can "copy" cells, and place then in the next available row inanother sheet that already has data in it. i want the contents of the "row" to be copied. Bear in mind a row will have several cells with data in it, like cell A1, cell B1, cell C1 etc...

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: copy row values to respective sheet if a criteria is met

    This may help with the first part of your request. Not sure how to handle the second part, though.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    09-14-2014
    Location
    new york
    MS-Off Ver
    2010
    Posts
    4

    Re: copy row values to respective sheet if a criteria is met

    thanks for replying JOHN H.DAVIS, your VBA code works fine as is, but:

    If i first enter 1 in the cell and then enter data in the adjacent cells, i notice the data in the adjacent cells are not copied to the respective sheet. i would have to first input data in the adjacent cells first then in columnA. Is there a way to fix that? like a VBA that would show an update button 3 cells away from the active row i'm typing in.

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: copy row values to respective sheet if a criteria is met

    The code is based on the number you place in Column 1 ("A"). That's the event you requested in Post #1. I'm sure we can help, but I'm a bit confused on what you actually want. Do you want to include other Columns? If so then what would trigger the copy to respective sheets for the other columns?

  7. #7
    Registered User
    Join Date
    09-14-2014
    Location
    new york
    MS-Off Ver
    2010
    Posts
    4

    Re: copy row values to respective sheet if a criteria is met

    I apologise for the misunderstanding, is it possible to get a VBA code that would show an update "button" each ttime i input data in a row and but would still check to see if the value in Column 1 ("A") is 1 or 2 or 3, and after button click enter the amount into respective sheets. the button would disappear after the update is completed to the relevant sheet, and reappear when i enter new data in another row in columnA.

  8. #8
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,052

    Re: copy row values to respective sheet if a criteria is met

    Do you have a sample workbook to share?

+ 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. copy a picture in the sheet as comment background in sheet2 in respective cells
    By KK1234 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-25-2014, 05:48 AM
  2. Replies: 11
    Last Post: 04-08-2013, 05:53 PM
  3. Copy values from another sheet based on criteria
    By webisti in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-25-2013, 02:48 PM
  4. [SOLVED] Copy values from one sheet to another as per given criteria in sheet nr 3
    By maciekban in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-07-2012, 01:50 PM
  5. copy data from main sheet to respective sub sheets
    By sshanku1985 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 03-14-2011, 12:26 PM

Tags for this Thread

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