Hi,
I am trying to copy the first 250 rows of data from 1 workbook to another so the daily file I use doesn't get too big.
What I want to happen is the following:
1. Select and copy or cut the first 250 rows. Filename PO Cover
2. Paste onto file name Book1 but looking for the first blank row.
3. Save Book1 and close the file.
4. Delete the selected 250 rows from file name PO Cover.
5. Save PO Cover
This is the code I have so far:
I know I haven't got all the code there at the moment but that's because I keep getting this error Pastespecial method of range class failed and I can't get past it.
Any help would be appreciated.
Thanks
Dan
I am trying to copy the first 250 rows of data from 1 workbook to another so the daily file I use doesn't get too big.
What I want to happen is the following:
1. Select and copy or cut the first 250 rows. Filename PO Cover
2. Paste onto file name Book1 but looking for the first blank row.
3. Save Book1 and close the file.
4. Delete the selected 250 rows from file name PO Cover.
5. Save PO Cover
This is the code I have so far:
Code:
Option Explicit
Sub Macro1()
Dim lrcd As Long
Dim wb As Workbook
Dim ws As Worksheet
With Application
.ScreenUpdating = False
Application.Run "'PO COVER 2019.xlsm'!UnlockandDisable"
Rows("3:253").Select
Application.CutCopyMode = False
Selection.Cut
' Selection.Delete Shift:=xlUp
ActiveWorkbook.Save
Set wb = Workbooks.Open(Filename:="C:\Users\Dell\Desktop\Book1.xlsx")
Set ws = wb.Worksheets("copy")
lrcd = Sheets("copy").Range("A" & Rows.Count).End(xlUp).Row
Sheets("copy").Cells(lrcd + 1, "A").Select
[COLOR=#ff0000]Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _[/COLOR]
[COLOR=#ff0000] :=False, Transpose:=False[/COLOR]
Sheets("copy").Cells(lrcd + 1, "A").Select
wb.Worksheets("copy").Save
wb.Worksheets("copy").Close
With Application
.ScreenUpdating = True
End With
End With
End Sub
I know I haven't got all the code there at the moment but that's because I keep getting this error Pastespecial method of range class failed and I can't get past it.
Any help would be appreciated.
Thanks
Dan