Run-time error '1004'

Misca

Well-known Member
Joined
Aug 12, 2009
Messages
1,749
Office Version
  1. 365
Platform
  1. Windows
I can't figure out how to get rid of the Run-time error '1004':

My VBA code is supposed to write a simple ISERROR-function to the worksheet. When I type it manually and record a macro the code reads:
Code:
ActiveCell.FormulaR1C1 = _
        "=IF(ISERROR(VLOOKUP(VALUE(E2),Pnro,5)),"""",VLOOKUP(E2),Pnro,5))"
But when I try to make the code type the same function or run the recorded code I'm getting "Run-time error '1004' - Application-defined or object-defined error".

I thought I might be missing a reference so I tried adding the atpvbaen.xls just in case but it didn't help.

How do I get rid of the error?
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Perhaps:-
Code:
ActiveCell.FormulaR1C1 = _
        "=IF(ISERROR(VLOOKUP(E2,Pnro,5)),"""",VLOOKUP(E2,Pnro,5))"
 
Upvote 0
Thanks!

A typo never even crossed my mind: I was positive I had not touched the recorded code but looks like I had.
 
Upvote 0
Hi Gurus,

i have a similar problem with run time error 1004 and pastespecial method of range class failed Here are my codes. Please I need you help to overcome this

thanks in advance


Sub transfer_data_to_week_report()

'transfer data from week dashboard to previous week report file



Range("A153").Select
Datez = ActiveCell
'
'yearz
'
yearz = Right(Year(Datez), 2)

'
'Numéro de Mois
'

'Numéro de Semaine
'
numSem = DatePart("ww", Datez)
indexSem = numSem - 1
'
'Numéro du Jour
'
numJour = Day(Datez)

'



Range("A20:K149").Select
Selection.Copy



Workbooks.Open Filename:= _
"E:\WR" & yearz & "_" & indexSem & ".xls"


ActiveWorkbook.Sheets("Verl F1&2").Activate


Range("U5").Select

Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False


ActiveWorkbook.Close True


End Sub
 
Upvote 0

Forum statistics

Threads
1,214,798
Messages
6,121,635
Members
449,043
Latest member
farhansadik

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