+ Reply to Thread
Results 1 to 12 of 12

Find Phrases and copy text in between

  1. #1
    Registered User
    Join Date
    04-07-2015
    Location
    Argentina
    MS-Off Ver
    2013
    Posts
    8

    Find Phrases and copy text in between

    Hi! i need some help please!
    i need to find a phrase into an excel sheet, once it is found, then copy from that information until another phrase, for example
    Hello

    1 2 3 4 5 6 8
    2 3 4 5 6 7 8
    5 7 8 9 6 4 3
    6 5 6 7 8 9 0
    7 2 3 4 5 6 7

    Bye

    So, i need to find "Hello" and then copy FROM "Hello" until the information above "Bye", "Bye" must not be included in the copy area.

    Can you help me please?

    thanks!!

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Find Phrases and copy text in between

    This copies the content from Column A to Column D. Hope that helps.

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    04-07-2015
    Location
    Argentina
    MS-Off Ver
    2013
    Posts
    8

    Re: Find Phrases and copy text in between

    Thanks! i get an error with the last code
    Cells(w, "A").Copy Range("D" & Rows.Count).End(3)(2)
    not sure why, but does this code copy the information between "Hello" and "Bye" no matter where they are located?

    thanks again!

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Find Phrases and copy text in between

    What is the error?

    Modified to not include "Hello"

    Please Login or Register  to view this content.
    It currently searchs Column A

  5. #5
    Registered User
    Join Date
    04-07-2015
    Location
    Argentina
    MS-Off Ver
    2013
    Posts
    8

    Re: Find Phrases and copy text in between

    the error is:
    Application-defined or object-defined error.

    It comes up after this part of the code:
    Cells(w, "A").Copy Range("D" & Rows.Count).End(3)(2)

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Find Phrases and copy text in between

    Make sure you have all of your Dim statements.

  7. #7
    Registered User
    Join Date
    04-07-2015
    Location
    Argentina
    MS-Off Ver
    2013
    Posts
    8

    Re: Find Phrases and copy text in between

    i haven't modified that info.
    Don't worry, anyway i think that code doesn't do what i need. i was told i need to use FOR in order to do what i want, but i'm not sure how nor where!

    thanks anyway!!!!!!!!!

  8. #8
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Find Phrases and copy text in between

    Can you provide a sample workbook with some dummy data? Do you want it too be for all sheets in the workbook?

  9. #9
    Registered User
    Join Date
    04-07-2015
    Location
    Argentina
    MS-Off Ver
    2013
    Posts
    8

    Re: Find Phrases and copy text in between

    Hope this works!!
    thanks a lot for your help
    Attached Files Attached Files

  10. #10
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Find Phrases and copy text in between

    This just selects the Range. You need to add a destination to paste. Just replace .Select with .Copy and add the destination.

    Please Login or Register  to view this content.
    Also I added Usedrange to find the search text. The previous code may not have worked because it was searching for data in Column A. On this sample at least there was none too be found.

  11. #11
    Registered User
    Join Date
    04-07-2015
    Location
    Argentina
    MS-Off Ver
    2013
    Posts
    8

    Re: Find Phrases and copy text in between

    thanks a lot for your time!!!!!!!!

  12. #12
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Find Phrases and copy text in between

    You're welcome. Glad to help out.

+ 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] Can I find duplicate phrases (not just occurrences of single words)?
    By michigandrea in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 04-17-2014, 09:06 AM
  2. Format certain phrases of concatenated text
    By leaning in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-20-2011, 11:53 AM
  3. Compare lists of phrases in two workbooks and import only missing phrases
    By Fireblejd in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-10-2011, 06:59 AM
  4. [SOLVED] Use of Text Phrases in Excel Functions
    By Girija in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 03-16-2006, 02:35 AM
  5. Modify sub to swap text phrases in cells
    By Max in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-07-2005, 08:05 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