Excel is not liking something, but I know not what.
The following error comes up;
I've stuck to xlPasteValues.Run time error '1004':
PasteSpecial method of Range Class failed
The target range is the same size as the copied range size.
I've tried without the 'protection.
Here's the sub;
Code: Select all
Sub MainData()
'
' Copy Paste the entries to the OCC tab
'
Dim SceNo As Integer
Dim RowNo As Integer
Sheets("Input").Select
'Sheets("Input").Unprotect ("******")
SceNo = Range("P2") + 6
Range(Cells(7, "B"), Cells(SceNo, "M")).Select
Selection.Copy
Sheets("OCC").Visible = True
Sheets("OCC").Select
'Sheets("OCC").Unprotect ("*********")
Range("B6:R6").Select
Selection.AutoFilter
Range("B7").Select
RowNo = Range("O2").Value
Range(Cells(RowNo, "D"), Cells((RowNo + (SceNo - 7)), "O")).Select ' PasteSpecial Paste:=xlPasteValues ◄ error line
'Sheets("OCC").Protect ("********")
End Sub