+ Reply to Thread
Results 1 to 14 of 14

When a search term appears in column I, copy the value from column H to a new cell.

  1. #1
    Registered User
    Join Date
    10-27-2012
    Location
    Canada
    MS-Off Ver
    LibreOffice
    Posts
    8

    When a search term appears in column I, copy the value from column H to a new cell.

    Elaborated:

    Need a macro to go through a column (I) and everytime a search term appears, it copies the contents of a cell from the same row different column (H) to a new location. (new sheet?)

    for example:

    The word "Banana" appears in I25. In H25 is the word "Car". The word "Car" is copied to a different sheet in A1. The next time "Banana" appears in column I, the corresponding value from H is copied to A2. When it has finished cycling through, a list has been created consisting of all the H values when a specific term appeared in Column I.

    I have worked on this for a while and can't get far. I'm not very good with excel. I need to use this macro for a bunch of different terms and have quite a bit of data gathering to do, but can't get started.

    Any help is greatly appreciated.
    Thanks

  2. #2
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    882

    Re: When a search term appears in column I, copy the value from column H to a new cell.

    One way is to use the basic syntax below

    Please Login or Register  to view this content.
    If my solution worked (or not) please let me know. If your question is answered then please remember to mark it solved

    Computers are like air conditioners. They work fine until you start opening windows. ~Author Unknown

  3. #3
    Registered User
    Join Date
    10-27-2012
    Location
    Canada
    MS-Off Ver
    LibreOffice
    Posts
    8

    Re: When a search term appears in column I, copy the value from column H to a new cell.

    This is for LibreOffice, and with that code I get a syntax error: "unknown data type range"

  4. #4
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    882

    Re: When a search term appears in column I, copy the value from column H to a new cell.

    Sorry didn't spot the LibreOffice in the version. I have had no dealings with LibreOffice so I am afraid I will have to bale out.
    Are there no LibreOffice forums????

  5. #5
    Registered User
    Join Date
    10-27-2012
    Location
    Canada
    MS-Off Ver
    LibreOffice
    Posts
    8

    Re: When a search term appears in column I, copy the value from column H to a new cell.

    I tried it on my friend's laptop and get an error. "Compile error: expected end of statement"

  6. #6
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    882

    Re: When a search term appears in column I, copy the value from column H to a new cell.

    That's probably on the sub line where somehow I got some strange letters in there
    Please Login or Register  to view this content.
    should be
    Please Login or Register  to view this content.
    If it is highlighting any other line post back

  7. #7
    Registered User
    Join Date
    10-27-2012
    Location
    Canada
    MS-Off Ver
    LibreOffice
    Posts
    8

    Re: When a search term appears in column I, copy the value from column H to a new cell.

    Run-time error '9'"
    Subscript out of range

    If i hit "debug" it highlights the third line.


    thanks for all your help with this

  8. #8
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    882

    Re: When a search term appears in column I, copy the value from column H to a new cell.

    What are the sheets you are copying to and from called?

  9. #9
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    882

    Re: When a search term appears in column I, copy the value from column H to a new cell.

    See attached workbook. First check Sheet2 is empty, then go to Sheet1, click the button then look again at Sheet2
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    10-27-2012
    Location
    Canada
    MS-Off Ver
    LibreOffice
    Posts
    8

    Re: When a search term appears in column I, copy the value from column H to a new cell.

    canadian army and sheet 1

  11. #11
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    882

    Re: When a search term appears in column I, copy the value from column H to a new cell.

    Please Login or Register  to view this content.
    Please make sure that the sheetnames are exact i.e. "sheet 1" including the gap and no capitals isn't "Sheet1"
    Last edited by WasWodge; 10-28-2012 at 03:24 PM. Reason: Code tags

  12. #12
    Registered User
    Join Date
    10-27-2012
    Location
    Canada
    MS-Off Ver
    LibreOffice
    Posts
    8

    Re: When a search term appears in column I, copy the value from column H to a new cell.

    oh, woops. I thought the sheet1 and sheet2 just referred tot he place the files are, not the actual file names. Thats got it working now. thanks for your help!

  13. #13
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: When a search term appears in column I, copy the value from column H to a new cell.

    @ ShallowJamm

    Welcome to the forum.

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

  14. #14
    Registered User
    Join Date
    10-27-2012
    Location
    Canada
    MS-Off Ver
    LibreOffice
    Posts
    8

    Re: When a search term appears in column I, copy the value from column H to a new cell.

    I am aware of all of these things, thank you. I was waiting to see if WasWodge was going to reply.

+ 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