+ Reply to Thread
Results 1 to 8 of 8

Find failure in large cells

  1. #1
    Registered User
    Join Date
    06-18-2007
    Posts
    11

    Find failure in large cells

    I have a very large excel file (on-line store products). Today I was doing a major revision using Find & Replace. Much to my dismay I discovered that some of the cells that contained the "find string" were not found and not replaced. Further research shows that if a cell has > 1060 characters in it then the cell is not searched for the "find string". Once I found a offending cell I also found that none of the other global changes I had made over the last ???? time frame had been made either. --- what a mess ---

    It is not an option to reduce the # of characters per cell

    Any ideas how I can get the find & Replace function to work on these cells?

  2. #2
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127
    This may be accomplished using VBA. Can you post a sample of the file so we can see what we are working with?

    I'm not the best at VBA, but I'll see if I can get something done for you.

  3. #3
    Registered User
    Join Date
    06-18-2007
    Posts
    11
    The .xls file is over 9,000 records long by 25 cells wide. Attached is a txt file of the contents of a single offending cell.
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127
    Sorry I took so long to get back to you. I didn't have a chance to work on the problem. Since there have been no other solutions, I provide my answer.

    I created a sample file using the text string that you attached repeated a number of times. I have built in a userform to do a search and replace all. To open the userform, press CTRL+SHIFT+Q on your keyboard. Next, enter the text to search, and enter the replacement text, then press Replace All.

    This is a pretty basic setup, but it seems to work, and we can modify it to suit your needs better.
    Attached Files Attached Files
    Last edited by BigBas; 10-17-2007 at 03:31 PM. Reason: Forgot to attach the file

  5. #5
    Registered User
    Join Date
    06-18-2007
    Posts
    11
    Thank you very much BigBas for your time and effort.

    However, I need a full feature search and/or search replace function.
    (you know, like the ability to search only hi-lighted cells, step search replace,
    report count for search and/or replace all, etc., etc.

    What I was hoping to get from this group was:
    "Hey you idiot just reformat those cells from general to text or xxxx"
    or "upgrade to version xxx and the cell character limit is increased to xxx"
    or at least a confirmation that the 1060 character limit that I've bumped into is real and normal and not some freaky thing that happens only on my system because of my setup.

    I suppose if this is a real excel limit then a external search/replace function is not out of the question. But as I said above it would need to be a VERY capable full feature tool. In fact, it could use a few more features then the existing excel function.

    BTW, I'm using Excel 97 SR-2

  6. #6
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127
    Although I can't guarantee that this is the reason, I think this link explains why the problem exists:

    http://support.microsoft.com/kb/211580

    The format that I gave you simply exploits the fact that functions still do work on the cells. (Although your search word may be after the 1,024 character cutoff, a search function can still detect it).

    Needless to say, my solution was a very general/basic setup that did a mass change based on simple criteria. If you do need a more comprehensive tool, why not post your needs specifically. Maybe another member or I can meet those needs.

  7. #7
    Registered User
    Join Date
    06-18-2007
    Posts
    11
    Well, a little playing around seems to support your assumption. The Excel Find function only looks at the first 1024 characters of the cell.

    Now that is just plain dumb.

  8. #8
    Registered User
    Join Date
    11-23-2011
    Location
    Calgary, Canada
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Find failure in large cells

    This code will search and replace text in the used range, even for cells with large numbers of characters. It has to loop within each cell multiple times, as the replace function only seems to replace one instance at a time. The code below changes every instance of "qz" in the worksheet with a new line character (chr(10)). Adapt as needed.

    Sub fixit()
    Dim fnd As String
    Dim rpl As String
    Dim cel As Range
    Dim rng As Range

    fnd = "qz"
    rpl = Chr(10)
    Set rng = ActiveSheet.UsedRange

    Application.ScreenUpdating = False
    For Each cel In rng
    Do While InStr(UCase(cel), UCase(fnd)) > 0
    cel = WorksheetFunction.Replace(cel, WorksheetFunction.Search(fnd, cel), Len(fnd), rpl)
    Loop

    Next cel
    Application.ScreenUpdating = True

    End Sub
    Last edited by searcher; 11-26-2011 at 10:57 AM.

+ 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