+ Reply to Thread
Results 1 to 10 of 10

Split text into array using multiple delimiters

  1. #1
    Registered User
    Join Date
    11-27-2013
    Location
    Rochester, NY
    MS-Off Ver
    Excel 2010
    Posts
    7

    Split text into array using multiple delimiters

    I'm writing a macro to spell check each word in a cell and simply change the color of misspelled words. The defualt delimiter is Chr(32), which is a space, but I'd like to also use Chr(10), line break, as our people often use soft breaks. Without the Chr(10) incorporated, if a misspelled word is at the beginning or end of a line, the correctly spelled word adjacent to it, if only separated by a line break, will also be highlighted. Here is my code:

    Please Login or Register  to view this content.
    I highlighted the split command in red, which is where I need to incorporate the space and line breaks as delimiters. Any help would be great!
    Last edited by TKFRMjarvis; 02-25-2014 at 03:58 PM.

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Split text into array using multiple delimiters

    Hey Jarvis,

    Why reinvent spellcheck?
    http://www.addictivetips.com/microso...in-excel-2010/
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    11-27-2013
    Location
    Rochester, NY
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Split text into array using multiple delimiters

    Good question MarvinP. I should have clarified. My company uses excel to layout large amounts of information related to signage manufacturing. Room numbers, Department names, Personnel names, paragraphs of text, lists, product codes, and the text varies from Upper-lower to all Caps. The normal spell check function is often impractical as it wants to check every name or product code, and these can number in the hundreds, even thousands in extreme cases. And it's apparent that many people will opt to skip spell check altogether, rather than click ignore...ignore...ignore. I currently have a different macro that highlights any cell with a misspelling and it works great, but I'm working on this one for cells with long paragraphs of text or lists, where it may be difficult to pick out the word. And the macro works great so far. I just need to figure out how to add another delimiter, or find an alternative if possible. It's an odd problem.

  4. #4
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: Split text into array using multiple delimiters

    Why not just replace the Chr(10)'s with Chr(32)

    Please Login or Register  to view this content.
    Gary's Student

  5. #5
    Registered User
    Join Date
    11-27-2013
    Location
    Rochester, NY
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Split text into array using multiple delimiters

    That may work. Would that alter the text in the cell? Because I have to maintain the line breaks that were entered.

  6. #6
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: Split text into array using multiple delimiters

    It should not alter the text in the cells with respect to the word separators because you are not re-joining vWords()

    Your code does not change the characters in oCell, only their formatting.
    Last edited by Jakobshavn; 02-25-2014 at 05:20 PM. Reason: explanation

  7. #7
    Registered User
    Join Date
    11-27-2013
    Location
    Rochester, NY
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Split text into array using multiple delimiters

    Hmm. I'm running it and getting the same results. The misspelled word is below 2 other words, separated by line breaks (alt+enter). All 3 words are being highlighted. I can't see why it wouldn't work, or why the chr(10)'s aren't getting replaced by 32.

  8. #8
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Split text into array using multiple delimiters

    Perhaps you have some char(160) mixed in with the space characters. I see this problem frequently.

  9. #9
    Registered User
    Join Date
    11-27-2013
    Location
    Rochester, NY
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Split text into array using multiple delimiters

    I've been fooling around with it and my problem is somewhat enigmatic. If I find & replace the Chr(10)'s by typing alt+0010, they all are found and replaced, so the Chr(10)'s are definitely there. But when I use vWords = Replace and tell it to find them, it doesn't seem to be working, because it highlights every everything that is separated by a Chr(10) and only stops when it hits a Chr(32). One thing I'm unsure about is if VB is searching for a 10 or a 0010? Not sure if this would be a factor, but I know Find/Replace only finds them in the spreadsheet if I type 0010.

  10. #10
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Split text into array using multiple delimiters

    Hi,

    See if this attached sheet helps to get the correct character into the Find Dialog Box.
    Attached Files Attached Files

+ 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] Sort Text into Rows by Multiple Delimiters/Values
    By BoostThis in forum Excel General
    Replies: 6
    Last Post: 11-22-2013, 12:31 PM
  2. Use of multiple delimiters under Text To Columns
    By ryandonn in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-20-2013, 03:05 PM
  3. Excel Split Single Cell Array into Multiple Cells
    By devinpitcher in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 12-07-2012, 07:13 AM
  4. Replies: 3
    Last Post: 08-06-2009, 04:27 AM
  5. Use of multiple-character delimiters under Text To Columns
    By longtalker in forum Excel General
    Replies: 3
    Last Post: 03-16-2009, 06:00 PM

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