Привет, код работает, кроме последней строки. Я хотел бы заполнить строки G2: W2 на основе значения ячейки в столбцах E & F. Я довольно новичок в VBA, это их простой способ сделать это?
Sub TradeDump()
Dim ws As Worksheet
Dim wsp As Worksheet
Dim wsc As Worksheet
Dim i As Integer
Dim rng As Range
Dim rnge As Range
Dim Rnger As Range
Set wsp = Sheets("Pivot")
Set ws = Sheets("Cashflow Fix Data")
Set wsc = Sheets("Control")
Period = wsc.Range("Term")
ws.Range("E:F").ClearContents
Set rng = wsp.Range(wsp.Range("G6"), wsp.Range("G6").End(xlDown))
rng.Copy
For i = 1 To Period
NextRow = ws.Cells(ws.Rows.Count, "E").End(xlUp).Row + 1
'get the Next Empty Row
ws.Range("E" & NextRow).PasteSpecial xlPasteAll
'paste
Next i
Set rnge = wsp.Range(wsp.Range("J6"), wsp.Range("J6").End(xlDown))
rnge.Copy
For i = 1 To Period
NextRowF = ws.Cells(ws.Rows.Count, "F").End(xlUp).Row + 1
'get the Next Empty Row
ws.Range("F" & NextRowF).PasteSpecial xlPasteAll
'paste
Next i
Set Rnger = ws.Range("G2:W2")
Rnger.AutoFill Destination:=wsc.Range("Period")
End Sub