+ Reply to Thread
Results 1 to 4 of 4

Finding the range of cells that contain specific text

  1. #1
    Registered User
    Join Date
    06-12-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    2

    Finding the range of cells that contain specific text

    Hi All,


    I'm currently writing a macro that needs to search an entire worksheet for specific text - the text appears in several hundred (cells) rows.

    Where this text appears, I want to copy those rows, then paste them into another spreadsheet - the copy and paste part is easy - it's determining the code (vba) to will find the exact rows (first and last) that contain the cells where this text is found that is the problem.

    All help greatly appreciated.

    Thanks in advance

    Andrew

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Finding the range of cells that contain specific text

    Andrew,

    Welcome to the forum!
    Something like this should work for you:
    Please Login or Register  to view this content.
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    06-12-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    2

    Wink Re: Finding the range of cells that contain specific text

    Hi tigeravatar,

    Great bit of code!

    Does the job nicely - I can now use the value (range) stored in 'rng.Copy.Address' and copy them into a new xls with code similar to that below:

    Rows(rngCopy.Address).Select
    Selection.Copy
    Workbooks.Add
    Rows("2:2").Select
    ActiveSheet.Paste


    Thanks!

  4. #4
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Finding the range of cells that contain specific text

    You're very welcome

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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