Thread: Insert formula
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Insert formula

Try this

Sub Macro1()
Cells(6, 7).Formula = "=IF(ISNA(HLOOKUP($F$3&""\""&F7;'D:\Documents and
Settings\hz6tlm\Desktop\Users\[Users_snx6609.csv]Users_snx6609'!$377:$377;1;
FALSE));"""";""Admin"")"
End Sub


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"josuegm" wrote in message
ups.com...
Hello guys, I'm trying to place this formula in a cell:

=IF(ISNA(HLOOKUP($F$3&"\"&F7;'D:\Documents and

Settings\hz6tlm\Desktop\Users\[Users_snx6609.csv]Users_snx6609'!X:X;1;FALSE)
);"";"Admin")

Where the X:X is a variable coming from the worksheet...

I'm trying to use this code:

Sub Macro1()
Cells(6, 7).Select
Selection.Formula = "=IF(ISNA(HLOOKUP($F$3&"\"&F7;'D:\Documents and

Settings\hz6tlm\Desktop\Users\[Users_snx6609.csv]Users_snx6609'!$377:$377;1;
FALSE));"";"Admin")"
End Sub

But it's getting a Syntax error... So I didn't even try to manipulate
the variable... This formula is actually working on the sheet...

Could anybody help me?