Anagram Maker – Word Combination Generator Source Code

Anagram Maker – All possible Words Combination Generator

Get Excel VBA code to create your own Word Combination Generator in 2 mins. Just follow these simple steps.

  1. Create Excel as in below image.
  2. Press Alt F11 from Excel sheet to view the VB Editor
  3. Copy Paste the Anagram Maker Code into VB Editor.
  4. Type Input letters in Excel Sheet.
  5. Execute the code by pressing F5.
  6. Possible Word combinations will be written to Output sheet.

You have just created a Word combination generator or Anagram Solver with just Excel. This will create all possible words from a set of letters.

Anagram Maker – Letter Combination Generator

Here is the macro programming code in Excel that will make all words possible from a set of alphabets or characters.

When this code is executed, it first takes each letter,one at a time & places them in all possible position for each permutation or combination.

Private Sub AnagramMaker_Generate_Letter_Combinations_Of_Words()
'Mix up words Generator
'Add Sheet for Output Possible Words
Sheets.Add , ThisWorkbook.Sheets(1)
ThisWorkbook.Sheets(2).Activate

'Declare Variabes
Dim Count_Of_Alphabets As Double
Dim Possible_Words As Double
Count_Of_Alphabets = 1

'Calculate The Permutations
While ThisWorkbook.Sheets(1).Cells(1, Count_Of_Alphabets) <> ""
    Count_Of_Alphabets = Count_Of_Alphabets + 1
Wend
Count_Of_Alphabets = Count_Of_Alphabets - 1
ThisWorkbook.Sheets(1).Cells(3, 17) = Count_Of_Alphabets
ThisWorkbook.Sheets(1).Cells(4, 17) = "=fact(q3)"
Possible_Words = ThisWorkbook.Sheets(1).Cells(4, 17)

'Actual Code for Possible words Creator
n = Possible_Words
n1 = Count_Of_Alphabets
For Current_Alphabet = 1 To Count_Of_Alphabets
    n = n / n1
    Destination_Column = 1
    i1 = 0
    For Destination_Row = 1 To Possible_Words
        While i1 = n Or ThisWorkbook.Sheets(2).Cells(Destination_Row, Destination_Column) <> ""
            Destination_Column = Destination_Column + 1
            i1 = 0
            If Destination_Column > Count_Of_Alphabets Then
                Destination_Column = 1
            End If
        Wend
        'Write all Possible words to Output Sheet
        ThisWorkbook.Sheets(2).Cells(Destination_Row, Destination_Column).Select
        ThisWorkbook.Sheets(2).Cells(Destination_Row, Destination_Column) = ThisWorkbook.Sheets(1).Cells(1, Current_Alphabet)
        i1 = i1 + 1
    Next Destination_Row
    n1 = n1 - 1
Next Current_Alphabet

'Information section
ThisWorkbook.Sheets(1).Cells(10, 17) = "Http://OfficeTricks.com"

End Sub

The actual letters combination generation loop starts after the comment “Actual Code for Possible Words Creator”. Running the code in debug mode (F8), will reveal the actual logic implemented.

Copy all rows in output sheet to a notepad, remove the Spaces or Tabs & use the words made from the input letters. Not all the words generated by this Excel will be meaningful.

It just gives us all possible words that can be formed using the letters given as input.

Also Read: Remove Drop Down data validation list from Excel & VBA

Anagram Generator – Excel Words Combinations Maker

Create a new Excel workbook & design sheet as in below image to input letters combination.

Once the design is done, copy the above Excel programming vba code, paste it in vb editor for sheet1. If you are very new to this Excel developer coding stuff, then email to author to get a free version of this Excel App.

This design has a limitation of character length 8. But, you can extend it to accommodate more alphabets.

Excel Sheet Design – Anagrams Word Combination Generator

Anagram Word Combination Generate

This Excel programming vba combination generator can also be used a Anagram solver or scrabble word finder.

Anagram means ‘a word or phrase formed by rearranging another word’. So, this is what we are trying to do with a code. Be it Anagram or Scrabble, this app will help us to make words with these letters game.

Word Combination Generate – Examples

Input : word

Find words with these letters in them – ‘w’,’o’,’r’,’d’

Output: Make combination of words for above Input Letters

  1. word
  2. wodr
  3. wrod
  4. . . . . .
  5. rdow

Practical Applications of Word Combination Generator

This Excel could come handy in many other ways, some of them are explained in scenarios listed below.

  • Name Combination: Many of us should have heard, at least once, some Kid’s Names that combine the name of their parents. It would have been a fun experience for their parents to write down all possible words & choose the best from the list of names. Equally there are chances they might have missed some simple nice word.
  • Anagram Maker Puzzles: This excel application can also be used to jumble the alphabets of a meaningful word for any quiz program or anagram related questions.
  • Scrabble Word Finder: While playing scrabble puzzle, if you have decoded the letters but not able to find exact word combination, then use this app. It will guide to all possible combination of letters.
  • Password generator: If we have to periodically change system password or any internet/computer application Login password.
  • Beware – Old hackers might use it too: This is also a very simple prototype of Brute Force Search, which can generate all possible words to crack password.

Also Read: How to Password Protect Excel 2010 & 2007?

I hope you enjoyed trying this simplest version of Word Combination Generator. Leave your comments or suggestions if you liked it.

Additional References: