SubversiveInterloper
New Member
- Joined
- Aug 15, 2019
- Messages
- 12
Looking for a solution as to why the VBA below is copying & pasting everything twice.
I have 66 sheets total that I am copying & pasting values from N4:O33, where Column N is the part number, Column O is the drawing revision; two sheets are PG1 & PG2, the remaining sheets are R01 thru R64. There are blank cells within the range on some sheets (in case that is the reason for the duplication).
All this data is being pasted to a "Parts Master List" sheet so I can sort it for potential discrepancies as this is a massive program with shared components and with over 800 drawings and multiple revisions, I want to make sure every part has the latest & greatest revision of a drawing.
I have 66 sheets total that I am copying & pasting values from N4:O33, where Column N is the part number, Column O is the drawing revision; two sheets are PG1 & PG2, the remaining sheets are R01 thru R64. There are blank cells within the range on some sheets (in case that is the reason for the duplication).
All this data is being pasted to a "Parts Master List" sheet so I can sort it for potential discrepancies as this is a massive program with shared components and with over 800 drawings and multiple revisions, I want to make sure every part has the latest & greatest revision of a drawing.
VBA Code:
Sub CopyPasteSortItemCodes2()
Dim h As Long
For h = 1 To 2
Sheets(Format(h, "PG0")).Range("N4:O33").Copy
Sheets("Parts Master List").Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial Paste:=xlPasteValues
Next h
Dim i As Long
For i = 1 To 64
Sheets(Format(i, "R00")).Range("N4:O33").Copy
Sheets("Parts Master List").Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial Paste:=xlPasteValues
Next i
End Sub