私は、次のコードは、あなたを助けになると思う:A2ことで
Sub foo2()
Dim A2(), B2(), C2() As Variant 'Declare the variables as Variant arrays
Dim LastRowA, LastRowB, LastRowC As Long
LastRowA = Sheet1.Cells(Rows.Count, "A").End(xlUp).Row 'find the last row with data on column A
LastRowB = Sheet1.Cells(Rows.Count, "B").End(xlUp).Row 'find the last row with data on column B
LastRowC = Sheet1.Cells(Rows.Count, "C").End(xlUp).Row 'find the last row with data on column C
A2 = Sheet1.Range("A1:A" & LastRowA) 'take all values form A1 to the last row in that column into the A2 array
B2 = Sheet1.Range("B1:B" & LastRowB)
C2 = Sheet1.Range("C1:C" & LastRowC)
For x = LBound(A2) To UBound(A2) 'loop from the begining of the array until the end
Sheet1.Cells(x, 6).Value = A2(x, 1) 'enter the values of A2 into the column F which is the number 6
Sheet1.Cells(x, 7).Value = B2(x, 1) 'edit this values to "paste" the values wherever you wish
Sheet1.Cells(x, 8).Value = C2(x, 1)
Sheet1.Cells(x, 9).FormulaR1C1 = "=RC[-3]*RC[-2]*RC[-1]" 'this will enter the formula in those cells
Next x
End Sub
は、xからyに及ぶ、あなたが意味ですか列または行として?マクロレコーダーでExcelのコードを試してみましたか? – Xabier
返事ありがとうございます。私は列として信じています。 A2、B2、C2の範囲が1から3の場合、出力は次のようになります。 行1 - 1 1 1、1 ......行2 - 1 1 2、2 ....行3 - 1 1 3、3、およびect それぞれが独自の列になります –