View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default Fill formula from VBA

If you want the formula
range("a2").formula="=yourformla"
if you want the result
range("a2")=application.vlookup(etc

--
Don Guillett
SalesAid Software

"Archie" wrote in message
...
Hi,

I try to enter a formula in a cell using VBA: =VLOOKUP($L2;'Sheet
2'!$A$2:$D$6000;2;FALSE)
This fails with a Run-time error '1004'
Entering this formula by hand works OK

When I remove the reference to 'Sheet 2' it all works OK:
=VLOOKUP($L2;$A$2:$D$6000;2;FALSE)

It looks like a bug to me (or a feature?)

How can I insert this formula refering to another sheet in a cell using
VBA?