Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Syntax error

What is wrong with this line.It gives me a syntax error

ActiveCell.FormulaR1C1 = _

"=if(iserror(VLOOKUP(RC1,[abretesesamo.xls]Sheet1!range(data_rng),2,FALSE)),
_

"""",VLOOKUP(RC1,[abretesesamo.xls]Sheet1!range(data_rng),2,FALSE)"
Thanks for your help

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 698
Default Syntax error

Just guessing;

"=if(iserror(VLOOKUP(RC1,[

should be

"=if(iserror(VLOOKUP(R1C1,[

HTH
Regards,
Howard

"Pablo" wrote in message
ups.com...
What is wrong with this line.It gives me a syntax error

ActiveCell.FormulaR1C1 = _

"=if(iserror(VLOOKUP(RC1,[abretesesamo.xls]Sheet1!range(data_rng),2,FALSE)),
_

"""",VLOOKUP(RC1,[abretesesamo.xls]Sheet1!range(data_rng),2,FALSE)"
Thanks for your help



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Syntax error

is data_rng a defined name in your workbook. If you do
Insert=Name=define, is there name data_rng listed there. If not, then
that is your problem. If data_rng is a string variable, then you would need.

. . .range(" & data_rng & "),. . .

in each case.

If data_rng is an object variable of type range, then

. . .range(" & data_rng.Address & "),. . .

--
Regards,
Tom Ogilvly


"Pablo" wrote in message
ups.com...
What is wrong with this line.It gives me a syntax error

ActiveCell.FormulaR1C1 = _

"=if(iserror(VLOOKUP(RC1,[abretesesamo.xls]Sheet1!range(data_rng),2,FALSE)),
_

"""",VLOOKUP(RC1,[abretesesamo.xls]Sheet1!range(data_rng),2,FALSE)"
Thanks for your help



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Syntax error

If data_rng is an object variable of type range, then

. . .range(" & data_rng.Address & "),. . .

should actually probably be

If data_rng is an object variable of type range, then

. . .range(" & data_rng.Address(1,1,xlR1C1,True) & "),. . .


--
Regards,
Tom Ogilvy


"Tom Ogilvy" wrote in message
...
is data_rng a defined name in your workbook. If you do
Insert=Name=define, is there name data_rng listed there. If not, then
that is your problem. If data_rng is a string variable, then you would
need.

. . .range(" & data_rng & "),. . .

in each case.

If data_rng is an object variable of type range, then

. . .range(" & data_rng.Address & "),. . .

--
Regards,
Tom Ogilvly


"Pablo" wrote in message
ups.com...
What is wrong with this line.It gives me a syntax error

ActiveCell.FormulaR1C1 = _

"=if(iserror(VLOOKUP(RC1,[abretesesamo.xls]Sheet1!range(data_rng),2,FALSE)),
_

"""",VLOOKUP(RC1,[abretesesamo.xls]Sheet1!range(data_rng),2,FALSE)"
Thanks for your help





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Syntax error

I bet you still want to drop the .range() stuff.
<vbg
And maybe the external:=true???? (depending on what data_rng is/was/will be??)

Tom Ogilvy wrote:

If data_rng is an object variable of type range, then

. . .range(" & data_rng.Address & "),. . .

should actually probably be

If data_rng is an object variable of type range, then

. . .range(" & data_rng.Address(1,1,xlR1C1,True) & "),. . .

--
Regards,
Tom Ogilvy

"Tom Ogilvy" wrote in message
...
is data_rng a defined name in your workbook. If you do
Insert=Name=define, is there name data_rng listed there. If not, then
that is your problem. If data_rng is a string variable, then you would
need.

. . .range(" & data_rng & "),. . .

in each case.

If data_rng is an object variable of type range, then

. . .range(" & data_rng.Address & "),. . .

--
Regards,
Tom Ogilvly


"Pablo" wrote in message
ups.com...
What is wrong with this line.It gives me a syntax error

ActiveCell.FormulaR1C1 = _

"=if(iserror(VLOOKUP(RC1,[abretesesamo.xls]Sheet1!range(data_rng),2,FALSE)),
_

"""",VLOOKUP(RC1,[abretesesamo.xls]Sheet1!range(data_rng),2,FALSE)"
Thanks for your help




--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Syntax error

Not on the first suggestion although if it were a defined name you would -
my misread of the formula string.

--
Regards,
Tom Ogilvy


"Dave Peterson" wrote in message
...
I bet you still want to drop the .range() stuff.
<vbg
And maybe the external:=true???? (depending on what data_rng is/was/will
be??)

Tom Ogilvy wrote:

If data_rng is an object variable of type range, then

. . .range(" & data_rng.Address & "),. . .

should actually probably be

If data_rng is an object variable of type range, then

. . .range(" & data_rng.Address(1,1,xlR1C1,True) & "),. . .

--
Regards,
Tom Ogilvy

"Tom Ogilvy" wrote in message
...
is data_rng a defined name in your workbook. If you do
Insert=Name=define, is there name data_rng listed there. If not,
then
that is your problem. If data_rng is a string variable, then you would
need.

. . .range(" & data_rng & "),. . .

in each case.

If data_rng is an object variable of type range, then

. . .range(" & data_rng.Address & "),. . .

--
Regards,
Tom Ogilvly


"Pablo" wrote in message
ups.com...
What is wrong with this line.It gives me a syntax error

ActiveCell.FormulaR1C1 = _

"=if(iserror(VLOOKUP(RC1,[abretesesamo.xls]Sheet1!range(data_rng),2,FALSE)),
_

"""",VLOOKUP(RC1,[abretesesamo.xls]Sheet1!range(data_rng),2,FALSE)"
Thanks for your help




--

Dave Peterson



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Syntax error

Just disregard my posts. I should have started over.

--
Regards,
Tom Ogilvy


"Tom Ogilvy" wrote in message
...
If data_rng is an object variable of type range, then

. . .range(" & data_rng.Address & "),. . .

should actually probably be

If data_rng is an object variable of type range, then

. . .range(" & data_rng.Address(1,1,xlR1C1,True) & "),. . .


--
Regards,
Tom Ogilvy


"Tom Ogilvy" wrote in message
...
is data_rng a defined name in your workbook. If you do
Insert=Name=define, is there name data_rng listed there. If not, then
that is your problem. If data_rng is a string variable, then you would
need.

. . .range(" & data_rng & "),. . .

in each case.

If data_rng is an object variable of type range, then

. . .range(" & data_rng.Address & "),. . .

--
Regards,
Tom Ogilvly


"Pablo" wrote in message
ups.com...
What is wrong with this line.It gives me a syntax error

ActiveCell.FormulaR1C1 = _

"=if(iserror(VLOOKUP(RC1,[abretesesamo.xls]Sheet1!range(data_rng),2,FALSE)),
_

"""",VLOOKUP(RC1,[abretesesamo.xls]Sheet1!range(data_rng),2,FALSE)"
Thanks for your help







  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Syntax error

Have a good night's sleep and go get 'em tomorrow????

<gd&r

Tom Ogilvy wrote:

Just disregard my posts. I should have started over.

--
Regards,
Tom Ogilvy

"Tom Ogilvy" wrote in message
...
If data_rng is an object variable of type range, then

. . .range(" & data_rng.Address & "),. . .

should actually probably be

If data_rng is an object variable of type range, then

. . .range(" & data_rng.Address(1,1,xlR1C1,True) & "),. . .


--
Regards,
Tom Ogilvy


"Tom Ogilvy" wrote in message
...
is data_rng a defined name in your workbook. If you do
Insert=Name=define, is there name data_rng listed there. If not, then
that is your problem. If data_rng is a string variable, then you would
need.

. . .range(" & data_rng & "),. . .

in each case.

If data_rng is an object variable of type range, then

. . .range(" & data_rng.Address & "),. . .

--
Regards,
Tom Ogilvly


"Pablo" wrote in message
ups.com...
What is wrong with this line.It gives me a syntax error

ActiveCell.FormulaR1C1 = _

"=if(iserror(VLOOKUP(RC1,[abretesesamo.xls]Sheet1!range(data_rng),2,FALSE)),
_

"""",VLOOKUP(RC1,[abretesesamo.xls]Sheet1!range(data_rng),2,FALSE)"
Thanks for your help






--

Dave Peterson
  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Syntax error

I really apprecite everyone's comments. I will try some of the
suggestions tomorrow. Thank a million.
~ Pablo

Dave Peterson ha escrito:

Have a good night's sleep and go get 'em tomorrow????

<gd&r

Tom Ogilvy wrote:

Just disregard my posts. I should have started over.

--
Regards,
Tom Ogilvy

"Tom Ogilvy" wrote in message
...
If data_rng is an object variable of type range, then

. . .range(" & data_rng.Address & "),. . .

should actually probably be

If data_rng is an object variable of type range, then

. . .range(" & data_rng.Address(1,1,xlR1C1,True) & "),. . .


--
Regards,
Tom Ogilvy


"Tom Ogilvy" wrote in message
...
is data_rng a defined name in your workbook. If you do
Insert=Name=define, is there name data_rng listed there. If not, then
that is your problem. If data_rng is a string variable, then you would
need.

. . .range(" & data_rng & "),. . .

in each case.

If data_rng is an object variable of type range, then

. . .range(" & data_rng.Address & "),. . .

--
Regards,
Tom Ogilvly


"Pablo" wrote in message
ups.com...
What is wrong with this line.It gives me a syntax error

ActiveCell.FormulaR1C1 = _

"=if(iserror(VLOOKUP(RC1,[abretesesamo.xls]Sheet1!range(data_rng),2,FALSE)),
_

"""",VLOOKUP(RC1,[abretesesamo.xls]Sheet1!range(data_rng),2,FALSE)"
Thanks for your help






--

Dave Peterson


  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Syntax error

For that second suggestion, I think Tom meant:

....[abretesesamo.xls]Sheet1!" & data_rng.address(ReferenceStyle:=xlR1C1) & _
",2,false))....


Tom Ogilvy wrote:

is data_rng a defined name in your workbook. If you do
Insert=Name=define, is there name data_rng listed there. If not, then
that is your problem. If data_rng is a string variable, then you would need.

. . .range(" & data_rng & "),. . .

in each case.

If data_rng is an object variable of type range, then

. . .range(" & data_rng.Address & "),. . .

--
Regards,
Tom Ogilvly

"Pablo" wrote in message
ups.com...
What is wrong with this line.It gives me a syntax error

ActiveCell.FormulaR1C1 = _

"=if(iserror(VLOOKUP(RC1,[abretesesamo.xls]Sheet1!range(data_rng),2,FALSE)),
_

"""",VLOOKUP(RC1,[abretesesamo.xls]Sheet1!range(data_rng),2,FALSE)"
Thanks for your help


--

Dave Peterson


  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Syntax error

Just a variation of Tom's suggestion.

If data_rng is a named range (Insert|name|define), then drop the range() from
the formular1c1:

ActiveCell.FormulaR1C1 = _
"=if(iserror(VLOOKUP(RC1,[book2.xls]Sheet1!data_rng,2,FALSE))," _
& """"",VLOOKUP(RC1,[book2.xls]Sheet1!data_rng,2,FALSE))"

(You were missing a closing parentheses at the end, too.)

===
If data_rng is a variable that represents a range on sheet1 of the
abretesemamo.xls workbook, then maybe you could do it this way:

dim data_rng as range
with workbooks("abretesesamo.xls").worksheets("sheet1")
set data_rng = .range("A1:B999")
'or even .range("somename")
set data_rng = .range("somename")
'or just for overkill...
'the variable has the same spelling as the named range!
'it might make it easier to keep track of things
set data_rng = .range("data_rng")
end with

ActiveCell.FormulaR1C1 = _
"=if(iserror(VLOOKUP(RC1," & _
data_rng.Address(external:=True, ReferenceStyle:=xlR1C1) & ",2,FALSE))," _
& """"",VLOOKUP(RC1," & _
data_rng.Address(external:=True, ReferenceStyle:=xlR1C1) & ",2,FALSE))"




Pablo wrote:

What is wrong with this line.It gives me a syntax error

ActiveCell.FormulaR1C1 = _

"=if(iserror(VLOOKUP(RC1,[abretesesamo.xls]Sheet1!range(data_rng),2,FALSE)),
_

"""",VLOOKUP(RC1,[abretesesamo.xls]Sheet1!range(data_rng),2,FALSE)"
Thanks for your help


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
syntax error - help Jim May Excel Discussion (Misc queries) 2 August 23rd 07 09:08 PM
runtime error: syntax error or access violation oucsester[_2_] Excel Programming 1 May 3rd 06 05:51 PM
runtime error: syntax error or access violation oucsester Excel Programming 0 May 3rd 06 02:22 PM
variable not declared error & syntax error G. Beard Excel Programming 1 October 6th 05 09:16 PM
Syntax Error Runtime Error '424' Object Required sjenks183 Excel Programming 1 January 23rd 04 09:25 AM


All times are GMT +1. The time now is 12:00 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"