View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Michael Michael is offline
external usenet poster
 
Posts: 791
Default Loading a formula from VB

I am attempting to load a formula from VB. I get an object defined error on
the final line of code below

Dim formula_str As String

Range(M4).Select

formula_str =
"=IF(ISERROR(VLOOKUP(A4,'[filename.xls]sheet1'!$A$2:$B$100,2,FALSE)),0,VLOOKUP(A4,'[filename.xls]sheet1'!$A$2:$B$100,2,FALSE))"
ActiveCell.FormulaR1C1 = formula_str