ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Insert formula (https://www.excelbanter.com/excel-programming/368568-insert-formula.html)

josuegm

Insert formula
 
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?


Bob Phillips

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?




Trevor Shuttleworth

Insert formula
 
Try doubling up all the quotes except the first and the last

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"") "


Regards

Trevor


"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?




josuegm

Insert formula
 
Thanks for the assistance guys, but both things didn't worked...
Both'em display the following message error:

"Run-time error '1004':
Application-defined or object-defined error."

What's wrong? It seems so simple this code, just place a damn formula
in a cell! LOL... I had developed to do this search opening the
workbook and finding the contents, but it was taking a lot of time to
run completely.... So I thought that placing a formula would make
things easier... Indeed it does, but first the formula must be placed!
hahahahahaha...

Please guys, help me out!


Bob Phillips

Insert formula
 
Try this

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"" )"

; is your statement separator in a formula, not , I assume?

--
HTH

Bob Phillips

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

"josuegm" wrote in message
oups.com...
Thanks for the assistance guys, but both things didn't worked...
Both'em display the following message error:

"Run-time error '1004':
Application-defined or object-defined error."

What's wrong? It seems so simple this code, just place a damn formula
in a cell! LOL... I had developed to do this search opening the
workbook and finding the contents, but it was taking a lot of time to
run completely.... So I thought that placing a formula would make
things easier... Indeed it does, but first the formula must be placed!
hahahahahaha...

Please guys, help me out!





All times are GMT +1. The time now is 07:03 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com