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

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
68,247
Office Version
  1. 365
Platform
  1. Windows
I can see nothing in that code, which would cause each range to be pasted twice.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,152,396
Messages
5,769,837
Members
425,574
Latest member
grimeslisa

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
Top