Pastespecial method of range class failed 1004

farazbaqar92

New Member
Joined
May 8, 2018
Messages
2
Hi,

I have 2 sets of code. One copies the form and the second pastes it.
(the ancillary functions are sheet hide unhide etc)

The problem is, at times the codes work perfectly fine.
But sometimes i get the "pastespecial method of range class failed 1004" error.
I have created an excel ribbon with buttons for these functions already.
Furthermore, the copy code works on one workbook (the form) and the paste form works on a different workbook (new vendors record).
I switch between the workbooks manually.

Can someone please help as to why this is happening.
Here are my codes.


COPY CODE
Sub NVR_CopyFormData_v4()
'
' NVR_CopyFormData_v4 Macro
'


'
Application.ScreenUpdating = False
Sheets("DataCopySheet").Visible = True
Sheets("DataCopySheet").Select
Range("B1:B100").Select
Selection.Copy
Sheets("DataCopySheet").Visible = False
Sheets("Form").Select
Application.ScreenUpdating = True
End Sub


PASTE & NEW RECORD CODE
Sub NVR_InsertRecord_v4()
'
' NVR_InsertRecord_v4 Macro
'


'
Application.ScreenUpdating = False
Sheets("NewVF 1.4").Visible = True
Sheets("Extraction").Visible = True
Sheets("NewVF 1.4").Select
Range("B1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Extraction").Select
Rows("2:2").Select
Selection.Copy
Sheets("Master File").Select
Range("$A$14:$A$20000").Find("").Select
Selection.Insert Shift:=xlDown
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("NewVF 1.4").Visible = False
Sheets("Extraction").Visible = False
Sheets("Master File").Select
Range("$A$14:$A$20000").Find("").Select
ActiveWorkbook.Save
Application.ScreenUpdating = True
End Sub
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

Forum statistics

Threads
1,223,894
Messages
6,175,250
Members
452,623
Latest member
Techenthusiast

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