3

セルの範囲を移動するプログラムを作成しようとしていますが、Do ループの 1 つが機能しません。列のクロールの特定の要素。プログラムが実行されると、A7:J9 ではなく A7:A9 のみが埋められます。クロールは行 1 から L1 への移動に対して機能し、赤い線に値がない場合に機能します (A10 が空白の場合、B7:B9 が入力されます)。私の間違いは何ですか?

Sub Columntest()
Dim i As Integer, j As Integer, k As Integer
    i = 1
    j = 2
    k = 7
    Do Until i = 11
        Range("L1").Formula = Cells(1, i)
        If Cells(10, i).Value = "Low" Then
            Do Until j = 6
                Cells(j + 15, 1).Formula = Cells(j, i)
            j = j + 1
            Loop
                Do Until k = 10
                    Cells(k + 5, 1).Copy
                    Cells(k, i).PasteSpecial xlPasteValues
                k = k + 1
                Loop
        End If
        If Cells(10, i).Value = "High" Then
            Do Until j = 6
                Cells(j + 15, 1).Formula = Cells(j, i)
            j = j + 1
            Loop
                Do Until k = 10
                    Cells(k + 5, 2).Copy
                    Cells(k, i).PasteSpecial xlPasteValues
                k = k + 1
                    Loop
        End If
    i = i + 1
    Loop

サブ終了

4

1 に答える 1