Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Word Scramble
I am building a word scrambler in excel.
I want to: 1) enter a word into a cell 2) scramble it into every combination possible 3) check to see if each iteration is actually a word in english using the excel dictionary. Is it possible to access the spell check in VBA? Is it then possible to use it to see if my word combinations are in fact real words? I am assuming that I would have build a loop and use some sort of boolean variable to validate if the word is real relative to a list from the dictionary. Can anyone help me with this? Thanks TS |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Word Scramble
Do you want all permutations placed in a column in a worksheet, then run
the spell checker on them and mark the ones that are not flagged as misspelled? When you say combinations, do you want to check subsets. For example, if the word were Danville, do you want to check three letter words such as Dan, four letter words such as vile, etc or just do permutations of the 8 letters in Danville? -- Regards, Tom Ogilvy wrote in message om... I am building a word scrambler in excel. I want to: 1) enter a word into a cell 2) scramble it into every combination possible 3) check to see if each iteration is actually a word in english using the excel dictionary. Is it possible to access the spell check in VBA? Is it then possible to use it to see if my word combinations are in fact real words? I am assuming that I would have build a loop and use some sort of boolean variable to validate if the word is real relative to a list from the dictionary. Can anyone help me with this? Thanks TS |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Word Scramble
Now this was a fun macro to work on! I image this could become jumbles expert-want-a-be's best friend. Since it is such a large macr (and I imagine someone with a bit more time on their hands could figur out some ways to make it shorter in length), I have attached it as file. I did put a simple check in to prevent duplicate word findings but that check is bypassed if the algorythm finds one or more new word between duplicates. I did limit entry to 3 to 8 letters as the time i takes to run through all the permuations even at 8 letters is more tha most people can wait. I doubt anyone would even stick around t process the 362,880 possibilities with 9 letters. The macro will star upon opening the workbook and you can take it from there. Only word passing the "spelling test" will be entered on the worksheet. Let me know what you think of it or have any trouble with it! JerryG : +---------------------------------------------------------------- | Attachment filename: unscrambler.xls |Download attachment: http://www.excelforum.com/attachment.php?postid=375424 +---------------------------------------------------------------- ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages directly from http://www.ExcelForum.com ~~Now Available: Financial Statements.xls, a step by step guide to creating financial statements |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Word Scramble
Hey Jerry also just realized that the code doesn't omit repeated words
(i.e. "moon" creates "mono" twice because of the two "o"s. I didn't specify this either in the opening email. TS |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Word Scramble
This is more elegant, not mine however!!! Dim rw Dim cln As New Collection Sub anagrams() Dim word As String word = InputBox("Enter word") If Len(word) < 2 Then Exit Sub Else rw = 1 Call mix("", word) End If rw = 1 For Each w In cln Cells(rw, 1) = w rw = rw + 1 Next w End Sub Sub mix(x As String, y As String) ' SOURCE UNKNOWN Dim i As Integer, j As Integer j = Len(y) If j < 2 Then If Application.CheckSpelling(x & y) = True Then cln.Add x & y End If Else For i = 1 To j Call mix(x + Mid(y, i, 1), _ Left(y, i - 1) + Right(y, j - i)) Next End If End Sub I also have an algorythm to produce all the possible words that can be made from any letters from the longer word. However at the moment this is highly inelegant, do you want to see this too? ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~View and post usenet messages directly from http://www.ExcelForum.com/ ~~Now Available: Financial Statements.xls, a step by step guide to creating financial statements |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Word Scramble
Yeah I would be interested in seeing this algorithm.
Thank-you RK |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Word Scramble
Terry,
If you want to see a working example (code is locked) , my Excel Add-in "Display Word Combinations" is available for free upon direct request. (remove the xxx from my email address) It determines all possible permutations for a series of characters ( word/numbers). It eliminates duplicate combinations. The listing is added to the first empty column on the worksheet. Valid words in the list are highlighted and shown at the top of the list. It's pretty darn fast and shows a progress bar in the status bar while working. It comes with a one page Word.doc install/instructions file. Regards, Jim Cone San Francisco, CA XX wrote in message om... I am building a word scrambler in excel. I want to: 1) enter a word into a cell 2) scramble it into every combination possible 3) check to see if each iteration is actually a word in english using the excel dictionary. Is it possible to access the spell check in VBA? Is it then possible to use it to see if my word combinations are in fact real words? I am assuming that I would have build a loop and use some sort of boolean variable to validate if the word is real relative to a list from the dictionary. Can anyone help me with this? Thanks TS |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Word Scramble
Thanks for repsonse,
Tom: I don't necessarily need all the permutations of the words exported to the spreadsheet. They could all be stored in an array with only the right words being exported to the excel cell. Yes I also want to look at subsets as well. JerryG: I have not looked at the example yet. Will take a peek tonight. Jim: Thank-you. Will take a peek at it tonight as well. TS |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
Word Scramble
Jerry.
Works very well. I did not specify in advance but I also wanted it to pick up on subsets with the word itself (as Tom pointed out). The code as provided does not seem to do this. I will keep looking at it and try to see if I can figure it out. Thanks for your help. TS |
#10
Posted to microsoft.public.excel.programming
|
|||
|
|||
Word Scramble
Hey Jerry got another interesting result. As stated earlier, when I
type in "moon" I get moon, momo, moon, mono. I was assuming that was becuase it did not omit repeated words. But when I use "sister", I get sister, resist. I expected to see two "sister" and two resist because of the repeated "s". I will did into it. TS |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Scramble a number | Excel Discussion (Misc queries) | |||
how can i scramble data for a sweepstakes? | Excel Worksheet Functions | |||
Hi--how do I scramble a list randomly? | Excel Worksheet Functions | |||
How do I scramble a list in excel? | Excel Discussion (Misc queries) | |||
Scramble names | Excel Programming |