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
 

Forum statistics

Threads
1,081,575
Messages
5,359,711
Members
400,545
Latest member
Damntheman30

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...
Top