+ Reply to Thread
Results 1 to 8 of 8

Finding and Copying 1 Rows Above

  1. #1
    Registered User
    Join Date
    01-26-2011
    Location
    Toronto, Ontario
    MS-Off Ver
    Excel 2003
    Posts
    24

    Finding and Copying 1 Rows Above

    Hey!

    So I was wondering if I can get some help on making a marco that reads through the worksheet and finds a specific text, then coping that text into a specific column into the above row then copying that top row into another worksheet. Sounds a bit confusing? Any ideas?

    Thanks!
    Last edited by Cubical; 01-30-2011 at 07:51 PM. Reason: Solved

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Finding and Copying 1 Rows Above

    Hello Cubical,

    A real life example would be a good first step. If you have a workbook, that would be best. If not then post a before and after example.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    01-26-2011
    Location
    Toronto, Ontario
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: Finding and Copying 1 Rows Above

    I uploaded an example hopefully this helps.

    Thanks!
    Attached Files Attached Files

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Finding and Copying 1 Rows Above

    Hello Cubical,

    Thanks for posting the file. I don't you could have explained the layout and have it made sense. Does the file id always follow the sheet id?

  5. #5
    Registered User
    Join Date
    01-26-2011
    Location
    Toronto, Ontario
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: Finding and Copying 1 Rows Above

    Sorry about that. But yes, since the excel file is actually a dump file from another database some of the data is floating around in the wrong spot. The marco I wanted to create is to sort this file, and sort things into their proper headings. So the name of the person, would be moved up into the row with all the information, while the file ID is moved from the sheet ID, which is where its not suppose to be, into the file ID of the above row that is is under. As you can see in the example.
    Last edited by Cubical; 01-30-2011 at 05:20 PM. Reason: Missing a word.

  6. #6
    Registered User
    Join Date
    01-26-2011
    Location
    Toronto, Ontario
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: Finding and Copying 1 Rows Above

    So I have a file with a lot of information I don't need. From the example file you can see a description section in the before worksheet. I don't want that to be copied over to the after worksheet. I just want to somehow making a code to loop til the end of the file finding a the file ID, which has been misplace under the sheet ID. Then I want to copy the row above the found File ID and move it into the after worksheet. At this point also moving the File ID into the row just copied into its rightful field. Same with the name, it is 2 rows below its rightful row, I want to be able to copy that back into the row, when copying it over to the worksheet.

    I hope its clears things up a bit? To put it in simple terms. I have a messy file, I want to sort out that file by leaving everything I don't need in the old worksheet, and moving everything into I want into a new worksheet. With everything in its original fields.

  7. #7
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Finding and Copying 1 Rows Above

    Hello Cubical,

    Provided the real data output matches the example, you should not have any problems. It is difficult to create a macro to recopy or reformat data based only on 2 examples. As experience has taught me, consistency in output files is rare. The macro has been added to the attached workbook.
    Please Login or Register  to view this content.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    01-26-2011
    Location
    Toronto, Ontario
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: Finding and Copying 1 Rows Above

    I should be able to work with this, thank you very much!

+ 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