http://q.hatena.ne.jp/1198167363
VBAを使うには、Excelから「ツール」→「マクロ」→「Visual Basic Editor」でプロジェクトの中の「Sheet1」をダブルクリックするとコードを記述するウィンドウが表示されます。

デバッグウィンドウを開くには、「表示」→「イミディエイト ウィンドウ」

最初、質問の内容が?だったんですが、回答されている方の内容で、ようやく質問の意味が理解できました(^^);

Sub test()

        Dim a(5) As Integer
        Dim i As Integer
        Dim j As Integer

        For i = 1 To 5
                Do
                        j = Int(Rnd(1) * 5) + 1
                Loop While (a(j) <> 0)
                a(j) = i
        Next i

        Debug.Print "-----------"

        For i = 1 To 4
                Debug.Print (Str(a(i)) + "->" + Str(a(i + 1)))
        Next i

        Debug.Print (Str(a(5)) + "->" + Str(a(1)))
        Debug.Print "-----------"

End Sub

一応、組み合わせは出来たかな?
表示が並んでないので、いったん配列に入れて、
ソートして出したほうがわかりやすいかも。。。

ここに置いときます。→一筆書きの組み合わせ

Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© 2011 simple blog いろいろ勉強中 Suffusion theme by Sayontan Sinha