+ Reply to Thread
Results 1 to 13 of 13

Copy row data by condition

  1. #1
    Registered User
    Join Date
    11-29-2012
    Location
    Belgrade
    MS-Off Ver
    Excel 2003
    Posts
    15

    Copy row data by condition

    Hi. I need macro which will copy data from row to a new new workbook where if it find the same condition. It will be more clear if you see the example. Many thanks

    example.xls

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Copy row data by condition

    How many columns and rows are in your table?
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Registered User
    Join Date
    11-29-2012
    Location
    Belgrade
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: Copy row data by condition

    I have 5-6 tables like that one. But I have one which I am doing every day copy-paste. It has 60 rows and 15 columns. So it would be nice if you can help me with this one.

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Copy row data by condition

    Hi b,

    Try this and let me know of any issues:

    Please Login or Register  to view this content.
    Directions for running the routine(s) just supplied

    Copy the code to the clipboard

    Press ALT + F11 to open the Visual Basic Editor.

    Open your Workbook

    Select “Module” from the Insert menu

    Type "Option Explicit" then paste the code under it

    With the cursor between Sub and End Sub press F5 (F8 to Single Step)

    OR

    Press ALT + Q to close the code window.

    Press ALT + F8 then double click on the macro name

  5. #5
    Registered User
    Join Date
    11-29-2012
    Location
    Belgrade
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: Copy row data by condition

    I have a problem with this, and that is my fault. I did not say that I have data in upper row Year 2011 so now macro copies me all table, not just row year 2012, and nothing then is happening. It works fine with out data in row 2011, it is not your fault it is mine, so I would be very grateful if you could help me with this now. Sorry

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Copy row data by condition

    Hi B,

    See if this is what you want:

    Please Login or Register  to view this content.
    Last edited by xladept; 02-13-2013 at 08:36 PM.

  7. #7
    Registered User
    Join Date
    11-29-2012
    Location
    Belgrade
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: Copy row data by condition

    It does not work, it copies whole table, Year 2011 and 2012 data. Here is the new example of table, how it really looks like, simplified, but close to original. You have old and new sheet.

    Thank you for your time example1.xls

  8. #8
    Registered User
    Join Date
    11-29-2012
    Location
    Belgrade
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: Copy row data by condition

    Any help???? Please

  9. #9
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Copy row data by condition

    This is what I thought I had posted before - see if it's what you wanted:

    Please Login or Register  to view this content.
    Last edited by xladept; 02-23-2013 at 04:44 PM.

  10. #10
    Registered User
    Join Date
    11-29-2012
    Location
    Belgrade
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: Copy row data by condition

    It works perfectly. Thank you very much for your help.

  11. #11
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Copy row data by condition

    You're welcome! Glad it's working

  12. #12
    Registered User
    Join Date
    11-29-2012
    Location
    Belgrade
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: Copy row data by condition

    I am maybe annoying, but could you describe me what every line of code represent, becasue, I have different tables so I would like to use this for different purposes, so I need your help once more. and off-course to learn something

  13. #13
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Copy row data by condition

    You're not very annoying - hope this helps. (I write it this way because some of the features don't work as they should!)

    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)

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