+ Reply to Thread
Results 1 to 15 of 15

Find a value, copy the row, move to next row.

  1. #1
    Registered User
    Join Date
    11-22-2012
    Location
    Canton, Ohio
    MS-Off Ver
    Excel 2003
    Posts
    7

    Find a value, copy the row, move to next row.

    I need to search for a value in column "J" in "sheet1" then copy the data that is in that row from Column a to k into sheet2. Currently I have the following that copies the whole row:
    Please Login or Register  to view this content.
    I need to only copy and paste Column "a" through "k" and to move to the next row down after it fills the value. Help?

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Find a value, copy the row, move to next row.

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    11-22-2012
    Location
    Canton, Ohio
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Find a value, copy the row, move to next row.

    Thanks AB33 that defiantly helps (and works)...any idea how to get it to paste each result to a new row? For example when you run this macro row 2 is copied, then row 7 on top of it, then row 10 on top and so on. I want the macro to start at the top and do this:
    Find first row in column J that is "startup->copy to the other sheet->find the next value in J->copy it to the next blank row and so on


    Quote Originally Posted by AB33 View Post
    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Find a value, copy the row, move to next row.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    11-22-2012
    Location
    Canton, Ohio
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Find a value, copy the row, move to next row.

    It jumps back and forth between sheets but is only overwritting the data into a2:k2


    Quote Originally Posted by AB33 View Post
    Please Login or Register  to view this content.

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Find a value, copy the row, move to next row.

    No, it should not be.
    You should be on the active and have a sheet called Startup and run the code.

  7. #7
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Find a value, copy the row, move to next row.

    This is better code

    Please Login or Register  to view this content.

  8. #8
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Find a value, copy the row, move to next row.

    Please do not reply with quote

    I think there is a flaw in your code

    Please Login or Register  to view this content.
    As soon as the code finds blank cell in column,J, it is terminated, so It will not go in to next cell as you might have expected

  9. #9
    Registered User
    Join Date
    11-22-2012
    Location
    Canton, Ohio
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Find a value, copy the row, move to next row.

    Sorry about that. Tried the new code and it is doing the same thing i.e. not putting each instance of "startup" in a new row on the new sheet

  10. #10
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Find a value, copy the row, move to next row.

    "startup" in a new row on the new sheet .
    Do you want to create a new sheet for each startup"? Please post your sample book

  11. #11
    Registered User
    Join Date
    11-22-2012
    Location
    Canton, Ohio
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Find a value, copy the row, move to next row.

    I had to remove data from Column a,b,c as it is confidential
    Attached Files Attached Files

  12. #12
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Find a value, copy the row, move to next row.

    Okay!
    If you are copying to column A and that column first row is blank, the code will keep overwriting all the subsequent cells in to it because VBA treats the next empty cell which is column A.
    The easiest way would be to include the same heading on the start sheet in row 1, so that the next empty row would be 2 and so on.

  13. #13
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Find a value, copy the row, move to next row.

    Or if you wan to copy staring in column B as your data format shows, you can use line


    Please Login or Register  to view this content.

  14. #14
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Find a value, copy the row, move to next row.

    Lately, I am learning on overcoming my phobia with filter and a have a loop fatigue

    Please Login or Register  to view this content.

  15. #15
    Registered User
    Join Date
    11-22-2012
    Location
    Canton, Ohio
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Find a value, copy the row, move to next row.

    Yep "A" was blank in some. Fixed the problem. Last code is super fast too. THanks

+ 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