Hi
I am trying to get my macro to copy rows in another excel workbook and paste them further up the page in order to remove duplicate rows of data. I have three cells in that workbook that use formula to calculate the following:
AK2 - The number of the row everything below is pasted to
AK3 - The beginning row number of the selection to be copied
AK4 - The end row number of the selection to be copied
What I want is for the macro to select the rows numbers from AK3 throught to AK4 and paste them into the row number of AK2.
Here is the code I am using:
Sub Data_Harvester_IIIWay()
Dim wbk As Workbook
On Error Resume Next
Set wbk = Workbooks("BC.xlsx")
Workbooks("BC.xlsx").Sheets("BH3").Rows(Workbooks("BC.xlsx").Sheets("BH3").Range("AK3").Value & ":" & Workbooks("BC.xlsx").Sheets("BH3").Range("AK4").Value).Copy
Workbooks("BC.xlsx").Sheets("BH3").Range("$A$" & Workbooks("BC.xlsx").Sheets("BH3").Range("AK2").Value).Paste
On Error GoTo 0
If wbk Is Nothing Then
Set wbk = Workbooks.Open("C:\BC\BC.xlsx")
Workbooks("BC.xlsx").Sheets("BH3").Rows(Workbooks("BC.xlsx").Sheets("BH3").Range("AK3").Value & ":" & Workbooks("BC.xlsx").Sheets("BH3").Range("AK4").Value).Copy
Workbooks("BC.xlsx").Sheets("BH3").Range("$A$" & Workbooks("BC.xlsx").Sheets("BH3").Range("AK2").Value).Paste
End If
Set wkb = Nothing
End Sub
When I use this code it highlights the selection and copies it correctly but it does not paste it. No errors appear or anything, it just finishes without pasting the data.
Any help would be greatly appreciated as I have been tearing my hair out for hours 
Doug
Bookmarks