Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub CopyData()
- Dim xRow As Long
- Dim VInSertNum As Variant
- Dim lastrow As Long
- xRow = 2
- lastrowplus = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row + 1
- lastrow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
- Application.ScreenUpdating = False
- Do While (Cells(xRow, "A") <> "")
- VInSertNum = Cells(xRow, "X")
- If ((VInSertNum > 0) And IsNumeric(VInSertNum)) Then
- Range(Cells(xRow, "A"), Cells(xRow, "BB")).Copy
- Range(Cells(lastrow, "A"), Cells(lastrow, "BB")).Select
- Selection.Insert Shift:=xlDown
- xRow = xRow + VInSertNum - 1
- Range(Cells(lastrow, "C"), Cells(lastrow, "C")).Value = Application.VLookup(Cells(lastrow, "A"), Sheet16.Range("A1:C26"), 3, False)
- Range(Cells(lastrow, "A"), Cells(lastrow, "A")).Value = Application.VLookup(Cells(lastrow, "A"), Sheet16.Range("A1:C26"), 2, False)
- Range(Cells(lastrow, "O"), Cells(lastrow, "O")).Value = 0
- Range(Cells(lastrow, "Q"), Cells(lastrow, "Q")).Value = 0
- Range(Cells(lastrow, "X"), Cells(lastrow, "X")).Value = 0
- Range(Cells(lastrow, "Z"), Cells(lastrow, "Z")).Copy
- Range(Cells(lastrow, "Z"), Cells(lastrow, "Z")).PasteSpecial xlPasteValues
- End If
- xRow = xRow + 1
- Loop
- Application.ScreenUpdating = False
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement