I'm new to vba.
I have a list of data (A2:A19) on sheet1 and I need to paste it on sheet2 but for each data I need to skip 7 rows. I tried the code for the paste but failed. I dont know how to do the looping(i think). tq
I'm new to vba.
I have a list of data (A2:A19) on sheet1 and I need to paste it on sheet2 but for each data I need to skip 7 rows. I tried the code for the paste but failed. I dont know how to do the looping(i think). tq
Here's some code that would do it.
Sub InsertRow()
Dim Src As Range
Dim Dest As Range
Dim x As Long
Dim y As Long
Dim cel As Range
Set Src = ThisWorkbook.Worksheets("Sheet1").Range("a2:a19")
Set Dest = ThisWorkbook.Worksheets("Sheet2").Cells(y, 1)
x = 1
y = ThisWorkbook.Worksheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1).Row
For Each cel In Src
Dest = cel
x = x + 8
Set Dest = ThisWorkbook.Worksheets("Sheet2").Cells(x, 1)
Next
End Sub
Sub copypasteskip()
Dim name As String Dim src As Variant Dim dest As Variant Dim endnumber As Integer Dim finalrow As Variant Dim i As Integer Dim r As Integer
Set src = ThisWorkbook.Worksheets("ImportData") Set dest = ThisWorkbook.Worksheets("June")
endnumber = Cells(Rows.Count, "A").End(xlUp).Row finalrow = Worksheets("ImportData").Cells(Rows.Count, "D").End(xlUp).Row
'MsgBox "ok"
For r = 11 To endnumber
'name = Cells(r, "A").Value
For i = 14 To finalrow
Worksheets("ImportData").Cells(i, "D").Copy
Worksheets("June").Cells(r, "A").PasteSpecial xlPasteAll
Next i
r = r + 7
Next r
End Sub