+ Reply to Thread
Results 1 to 11 of 11

copy row based on column value

  1. #1
    Registered User
    Join Date
    08-29-2013
    Location
    Harrisburg
    MS-Off Ver
    Excel 2003
    Posts
    5

    copy row based on column value

    need some help in setting up his. need to copy entire row based on column value. If column is Y entire row should be copied to another sheet. example--if I column is Y showing individual is secondary migrant entire row with data to be copied to sheet called Secondary migrants.
    Attached Files Attached Files

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

    Re: copy row based on column value

    Try this macro in the worksheet code module.
    Please Login or Register  to view this content.
    Last edited by Mumps1; 08-29-2013 at 02:50 PM. Reason: Corrected code

  3. #3
    Registered User
    Join Date
    08-29-2013
    Location
    Harrisburg
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: copy row based on column value

    thanks ..it is not doing anything. i am not experienced with excel. this code goes under development right?

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

    Re: copy row based on column value

    You have to place the code in the worksheet code module. Do the following: right click the tab for sheet "RSS Database (TANF)". Click 'View Code'. Paste the macro in the empty code window that opens up. Close the code window to return to your sheet. When you enter a "Y" in column I, that row will be copied over to your other sheet.

  5. #5
    Registered User
    Join Date
    08-29-2013
    Location
    Harrisburg
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: copy row based on column value

    thanks. still not getting what i want on the second sheet. i want entire row with all data to be copied exactly as it is on the first sheet if criteria on the column I matches (Y). thanks so much.

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

    Re: copy row based on column value

    It works for me. Try the attached file. Make sure that you enter all your data in the cells in any row and that the "Y" is the last piece of data that you enter. Column I must be the last cell completed because it triggers the macro. Also make sure that you enter an uppercase "Y". I am using Excel 2010 and have saved the file in Excel 2003 format. I'm not sure if that may be giving you a problem.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    08-29-2013
    Location
    Harrisburg
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: copy row based on column value

    got it. thanks so much. last question is. recording starts automatically? secondary migrant sheet should look exactly the same (formatting). how do i start adding rows from specific row on the secondary migrants sheet? thanks

  8. #8
    Registered User
    Join Date
    08-29-2013
    Location
    Harrisburg
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: copy row based on column value

    it does it but each time I enter a new row, filed I when typing Y give me error 13 mismatch. I used same formula starting a new sequence for placements only to be copied into another sheet but did not work.

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

    Re: copy row based on column value

    The copying is done automatically as soon as you enter Y in column I and exit the cell. Have a look at the attached file. You will notice that the two sheets are now identical, however, you will have to adjust the column widths in 'Secondary migrants'. As far as the error you are getting, I'm not sure what is happeing to cause it. It is very difficult to trace a problem when I can't see the actual file you are using. In the attached file, when I add data into a new row and then enter a Y in column I, the row is copied to sheet "Secondary migrants". If you are trying to apply the macro in a different situation and the sheet names are different, the macro won't work. If you attach your actual file with a detailed explanation, I could have a closer look.
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    09-06-2013
    Location
    iran
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: copy row based on column value

    dear Mumps1
    TKS Lot

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

    Re: copy row based on column value

    My pleasure.

+ 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] Copy data from column to other sheets, based upon vlookup/criteria on column a
    By jedemeyer1 in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 03-27-2013, 04:01 AM
  2. [SOLVED] Copy Cells In One Column Based On Criteria In Another Column
    By hgteros in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 05-14-2012, 06:07 PM
  3. How to copy one column values to another column based on condition that row2 contain
    By sanjay19961 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-13-2010, 10:32 AM
  4. Replies: 2
    Last Post: 03-16-2009, 12:26 PM
  5. Copy Formula down the column based on data in the next column
    By karl_009 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-02-2008, 09:48 AM

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