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 CODESub 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
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 CODESub 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