+ Reply to Thread
Results 1 to 8 of 8

Need to generate 3-character words from 3 columns

Hybrid View

tmccar Need to generate 3-character... 09-17-2012, 05:08 AM
TMS Re: Need to generate... 09-17-2012, 05:15 AM
tmccar Re: Need to generate... 09-17-2012, 05:41 AM
TMS Re: Need to generate... 09-17-2012, 06:01 AM
tmccar Re: Need to generate... 09-17-2012, 06:26 AM
tmccar Re: Need to generate... 09-17-2012, 06:33 AM
TMS Re: Need to generate... 09-17-2012, 06:30 AM
TMS Re: Need to generate... 09-17-2012, 07:13 AM
  1. #1
    Registered User
    Join Date
    03-09-2011
    Location
    sligo
    MS-Off Ver
    Excel 2010
    Posts
    12

    Need to generate 3-character words from 3 columns

    I have 3 columns of characters - 44, 14 and 26 characters. How can I generate all 16016 possible word combinations of the characters in a new column?

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,539

    Re: Need to generate 3-character words from 3 columns

    something like:

    l = 1
    for i = 1 to 44
       for j= 1 to 14
          for k = 1 to 26
             Range("D" & l) = Range("A" & i) & Range("B" & j) & Range("C" & k)
             l = l + 1
          next 'k
       next 'j
    next 'i

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    03-09-2011
    Location
    sligo
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Need to generate 3-character words from 3 columns

    Thanks TM.
    Pardon my ignorance, but how do I run this? I know that Alt-F11 brings up the VBA editor, but what should I do then?

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,539

    Re: Need to generate 3-character words from 3 columns

    Type Sub and a subroutine name, and press Enter. Copy and paste the code between the Sub and End Sub. Press F5 to run it.

    Sub MakeWords()
    l = 1
    for i = 1 to 44
       for j= 1 to 14
          for k = 1 to 26
             Range("D" & l) = Range("A" & i) & Range("B" & j) & Range("C" & k)
             l = l + 1
          next 'k
       next 'j
    next 'i
    End Sub

    Regards, TMS

  5. #5
    Registered User
    Join Date
    03-09-2011
    Location
    sligo
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Need to generate 3-character words from 3 columns

    That works great, thanks
    Attached Images Attached Images

  6. #6
    Registered User
    Join Date
    03-09-2011
    Location
    sligo
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Need to generate 3-character words from 3 columns

    Yes, I was getting that first but it's OK now. I didn't mean to attach it, sorry.

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,539

    Re: Need to generate 3-character words from 3 columns

    Why the picture? You press F5 in the VB Editor, not on the worksheet.

    Or, in Excel, select and run the macro from the menu.

    Regards, TMS

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,539

    Re: Need to generate 3-character words from 3 columns

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ 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