+ Reply to Thread
Results 1 to 6 of 6

Search entire row, copy one below and paste in specific column

  1. #1
    Registered User
    Join Date
    04-08-2022
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    3

    Search entire row, copy one below and paste in specific column

    Hi all,

    I'm a complete newb with excel vba (vba in general). I usually download some info from a pdf into a csv. The csv is pretty messy, with all of the information displayed horizontally. For example:



    Course Title_1 Course Hours Course Prerequisites Course Title_2 Course Hours Course Prerequisites Course Title_3 Course Hours Course Prerequisites
    Math 2 25 Math 1 Language 2 30 Language 1 Science 2 20 Science 1




    I'd like it to look like this:

    Course Title Course Hours
    Math 2 25
    Language 2 30
    Science 2 20


    I copy the sheet and save it into a macro-enabled workbook. I've tried to create a macro based on bits of other code that I have found and came up with this:

    Please Login or Register  to view this content.

    I used the LIKE operator because I want to find all cells with the word "Title" or "Hours" because each heading may be different (e.g., "Course Title_1", "Course Title_2", etc.). Unfortunately, when I run this macro, nothing happens. Is it because I haven't set a range? I don't know how to select the whole sheet. Some of the csv files may have a lot of courses so it goes all the way to the FZ column for example, while other csv's have 6 courses so it might stop at column R. It varies.

    Can anyone help? Like I said, I'm a complete newb so I apologize in advance if the macro above looks completely messy and ridiculous.

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

    Re: Search entire row, copy one below and paste in specific column

    DO you also want to include the course prerequisites in your result? It would be easier to help and test possible solutions if you could attach a copy of your file. Explain in detail what you want to do referring to specific cells, rows, columns and sheets using a few examples from your data (de-sensitized if necessary). See the yellow banner at the top of this page for instructions to attach a file.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  3. #3
    Registered User
    Join Date
    04-08-2022
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    3

    Re: Search entire row, copy one below and paste in specific column

    No, I don't need the course prerequisites. This is what I need:

    - I only need the course title and course hours
    - I'd like to keep columns A to L as they are
    - I'd like to move all of the course titles (Q2, U2, Y2, etc.) and paste them in the next available row in column M
    - I'd like to move all of the course hours (R2, V2, Z2, etc.) and paste them in the next available row in column N

    A copy of the file is attached. Any help is appreciated.
    Attached Files Attached Files

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

    Re: Search entire row, copy one below and paste in specific column

    Try:
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    04-08-2022
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    3

    Re: Search entire row, copy one below and paste in specific column

    Wow! Amazing! Thank you 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,836

    Re: Search entire row, copy one below and paste in specific column

    You are very welcome.

+ 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] search specific text in a range (row) and copy entire column to another worksheet
    By pmchris in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-27-2019, 07:40 PM
  2. [SOLVED] Formula to Search entire column for a specific word and copy a different cells value.
    By mike rand in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 11-20-2018, 12:57 PM
  3. Search Item, Find, then Copy Paste Entire Row
    By kjbcox15 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-24-2013, 12:41 PM
  4. Search for specific date range, copy entire row and paste to new worksheet
    By turias in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-04-2013, 03:57 PM
  5. [SOLVED] Search a column for a value if found copy entire row and paste
    By awagenhurst in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-07-2012, 03:48 PM
  6. VBA Search workbook for user value, copy/paste entire row to last sheet for matching
    By jasonkrispy21 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-22-2012, 03:42 PM
  7. Search, copy and paste entire row into new workbook
    By wildcats0625 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 05-06-2010, 11:14 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