+ Reply to Thread
Results 1 to 4 of 4

Workaround needed for 255 character find limit

  1. #1
    Registered User
    Join Date
    01-26-2009
    Location
    Kansas, USA
    MS-Off Ver
    Excel 2007
    Posts
    51

    Workaround needed for 255 character find limit

    Hello,

    I have a problem, I'm using vba to look for a text string in column A, but the text string I'm looking for is greater than 255 characters.

    I need a workaround. I think I have an idea of what I want to do, I just don't know how to do it.

    I think I'd like to search for the first 255 characters (left(Combination, 255)) of my string. If I find the first 255 characters of a string in a cell, then search that specific cell to see if the last 255 characters (right(Combination, 255)) are present. If so, do something

    This is what I worked up so far, but it fails on the second find. Any help would be much appreciated. Thanks!
    Please Login or Register  to view this content.

  2. #2
    Forum Guru mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,230

    Re: Workaround needed for 255 character find limit

    You could use .Find (with the first 255 characters of your search term) to find a candidate cell and then use InStr to test the candidate cell against the entire search term.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  3. #3
    Registered User
    Join Date
    01-26-2009
    Location
    Kansas, USA
    MS-Off Ver
    Excel 2007
    Posts
    51

    Re: Workaround needed for 255 character find limit

    Thanks for the reply! I'm not at all familiar with InStr, how would I use it?

    You could use .Find (with the first 255 characters of your search term) to find a candidate cell and then use InStr to test the candidate cell against the entire search term.

  4. #4
    Forum Guru mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,230

    Re: Workaround needed for 255 character find limit

    For this example, lets pretend that the limit is 3.
    This routine searches column A for "catalog" by .Finding cells that start with "cat" and then checking to see if they are indeed "catalog" rather than "cat","catastrophy" etc.
    Please Login or Register  to view this content.
    Last edited by mikerickson; 10-27-2009 at 04:15 PM.

+ 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