Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default 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



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default 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


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default 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
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default 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
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default 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
  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Word Scramble

Yeah I would be interested in seeing this algorithm.

Thank-you

RK
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Scramble a number RobN[_2_] Excel Discussion (Misc queries) 8 April 22nd 09 04:44 PM
how can i scramble data for a sweepstakes? Ro Excel Worksheet Functions 2 October 28th 08 07:06 PM
Hi--how do I scramble a list randomly? lmcshelp Excel Worksheet Functions 1 November 1st 06 06:34 AM
How do I scramble a list in excel? Cate Excel Discussion (Misc queries) 5 April 12th 05 12:04 AM
Scramble names zxc[_4_] Excel Programming 1 August 31st 03 05:09 PM


All times are GMT +1. The time now is 09:20 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"