VBA Copy & Paste pasting Duplicates

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.

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
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
I can see nothing in that code, which would cause each range to be pasted twice.
 
Upvote 0

Forum statistics

Threads
1,215,038
Messages
6,122,798
Members
449,095
Latest member
m_smith_solihull

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top