View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Trefor Trefor is offline
external usenet poster
 
Posts: 201
Default Getting error 1004 trying to write formula in cell

Leith,

Many thanks for your fedback. It was all on one line, just the way this
systems works. Greg nailed it, it was double quotes.

--
Trefor


"Leith Ross" wrote:


Hello Trefor,

Is the Formula all on one line? if you break it you must use the line
continuation character (Underscore) preceded by a space at the end of
the line. If you don't, it won't compile.

Example:
If your code really looks like this, it won't run...

Sheets("test").Range("A1").Formula = "=IF(ISERROR(VLOOKUP($AE6,'Change
Report 6.0'!$C$20:$G$61,AG$4,FALSE)),"",VLOOKUP($AE6,'Cha nge Report
6.0'!$C$20:$G$61,AG$4,FALSE))"

If it has the line continuation characters it will...

Sheets("test").Range("A1").Formula = "=IF(ISERROR(VLOOKUP($AE6,'Change
_
Report 6.0'!$C$20:$G$61,AG$4,FALSE)),"",VLOOKUP($AE6,'Cha nge Report _
6.0'!$C$20:$G$61,AG$4,FALSE))"

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=487497