+ Reply to Thread
Results 1 to 16 of 16

Search for any Text String in specific range and copy + offset + move

  1. #1
    Registered User
    Join Date
    03-25-2010
    Location
    QC, Canada
    MS-Off Ver
    Excel 2007
    Posts
    29

    Search for any Text String in specific range and copy + offset + move

    Hello,

    I searched thru the forum but I didn't see any thread which discussed about searching for ANY TEXT VALUE string (NOT specific words) within a delimited range of cells then copy these TEXT strings + offset paralele data and move to specific bottom ranges. Please helps. I have jointed a excel sample with this thread.

    The text string value contains alphanumneric or special characters but not $ sign or currency format.
    The offset value contains currency values but no alpha.

    Thanks in advance,
    Attached Files Attached Files

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,475

    Re: Search for any Text String in specific range and copy + offset + move

    You example does not show what you are searching for.
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    03-25-2010
    Location
    QC, Canada
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: Search for any Text String in specific range and copy + offset + move

    Thanks for yr. interest to my request.

    In my example file, I want to search on the Range("F11:F39") to find any text string value. The text string value can be any alpha-numerical string but can't be a currency value or format, so in my example, the Range("F16:F19") and Range("F21:F22") is the text strings value which I would like to find.

    Once the text strings are found then I would like to use the function "Offset" to select the currency values located in paralele Range("J16:J19") and Range("J21:J22") as per my example file. Blank cells are to be skipped.

    Finally, move found values (Range("F16:F19") and Range("F21:F22")) and its Offset value (Range("J16:J19") and Range("J21:J22") ) to J46 & K46 and down rows respectively. Blank cells are not move.

    I hope my explanation are clear.

    Regards,
    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: Search for any Text String in specific range and copy + offset + move

    Hello FN2010,

    This macro will copy only data and the offset currency values to the range J46:K46 on down. The macro will clear any previously copied information. A button has been added to "Sheet1" to run the macro.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    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!)

  5. #5
    Registered User
    Join Date
    03-25-2010
    Location
    QC, Canada
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: Search for any Text String in specific range and copy + offset + move

    Hello Leith,

    Yr. code is working fine with a small problem as my text string values must only contains a text value or a combination of text & number values or a text & signs values or a text & number & signs values but can't be only containing a single value as currency value or number value or sign value.

    Regards,

  6. #6
    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: Search for any Text String in specific range and copy + offset + move

    Hello FN2010,

    Can you post a copy of the workbook with the data you described? In cases of pattern matching, the more data the better.

  7. #7
    Registered User
    Join Date
    03-25-2010
    Location
    QC, Canada
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: Search for any Text String in specific range and copy + offset + move

    Hello Leith,

    Please see the attached file for sample.

    I just want to adjust the RegExp so that don't pickup any data that contain SINGLE values as currency, munerical or special characters.

    Regards,
    Attached Files Attached Files

  8. #8
    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: Search for any Text String in specific range and copy + offset + move

    Hello FN2010,

    I just came in from watering my garden. This workbook is identical to the first. Can you provide me with examples of text that are causing the macro to fail? Your descriptions are not enough.

  9. #9
    Registered User
    Join Date
    03-25-2010
    Location
    QC, Canada
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: Search for any Text String in specific range and copy + offset + move

    Hello Leith,

    OK, The file is in sheet2 but I just want to know how-to only create a RegExp that only extract text string value

    Regards
    Attached Files Attached Files

  10. #10
    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: Search for any Text String in specific range and copy + offset + move

    Hello FN2010,

    If I understand you correctly, you want only the alphabetic characters a -z and A - Z. All other characters, except spaces, are to be excluded, yes?

  11. #11
    Registered User
    Join Date
    03-25-2010
    Location
    QC, Canada
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: Search for any Text String in specific range and copy + offset + move

    Hello Leith,

    No I want any text string [a-z] or any combination of text string with number [a-z][0-0] or any combination of text string, number and special characters [a-z][0-9][.*/?%,...]

    But I don't want any single numerical value [0-9] as 178 or any combination of special characters as .*/?%,... alone.

    My string value may contains text + % or + 5,6,7

    Regards,

  12. #12
    Registered User
    Join Date
    03-25-2010
    Location
    QC, Canada
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: Search for any Text String in specific range and copy + offset + move

    Hello Leith,

    Any helps for the last point pending for this request???

    Regards,

  13. #13
    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: Search for any Text String in specific range and copy + offset + move

    Hello FN2010,

    Still working on it. I have had several appointments today that have limited my time with forum.

  14. #14
    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: Search for any Text String in specific range and copy + offset + move

    Hello FN2010,

    Okay, I think this should work. The macro will only copy information that contains one or more alpha characters. That means any special characters or numbers or combination of both will be ignored (not copied) if there are no alpha characters present. Delete the old macro and copy this one in its place.
    Please Login or Register  to view this content.

  15. #15
    Registered User
    Join Date
    03-25-2010
    Location
    QC, Canada
    MS-Off Ver
    Excel 2007
    Posts
    29

    Smile [SOLVED] Re: Search for any Text String in specific range and copy + offset + move

    Hello Leith,

    Sorry for late reply.

    Yr. lastest code is working as I want. Thanks you very much.

    FN2010

  16. #16
    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: Search for any Text String in specific range and copy + offset + move

    Hello FN2010,

    There was much rejoicing! Glad to hear that. If you need anything else, let me know.

+ 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