Results 1 to 2 of 2
  1. #1
    New Lounger
    Join Date
    Dec 2005
    No. VA, Virginia, USA
    Thanked 0 Times in 0 Posts

    number generator (Office 2003)

    I have the numbers 1 through 6. I want a formula that generates all the 3-digit numbers that can be made using those 6 digits without repeating any digit within the 3-digit numbers, and without duplicating any 3-digit numbers. I don't even have a clue as to where to begin. Help, please...

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 31 Times in 31 Posts

    Re: number generator (Office 2003)

    You can use this macro:

    Sub GenerateNumbers()
    Const MaxNum = 6
    Dim i As Integer, j As Integer, k As Integer
    Dim r As Long
    For i = 1 To MaxNum
    For j = 1 To MaxNum
    If j <> i Then
    For k = 1 To MaxNum
    If k <> i And k <> j Then
    r = r + 1
    Cells(r, 1) = 100 * i + 10 * j + k
    End If
    Next k
    End If
    Next j
    Next i
    End Sub

    Adapt as needed.

    Warning: as is, the macro will clear column A in the active worksheet, then produce the list of numbers in this column.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts