Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default Run Time Error, FormulaR1C1

I have two sheets in the same workbook. In the first sheet, I'm trying to
programmatically populate cells with formulae to insure the correct formula
is always in the cells. The cell is too the left of a MSQuery, and the
formulae are not copying down along with the query refresh. When the code
runs, I'm getting a <run time error at this line.

Range("A2").FormulaR1C1 =
"=UPPER(IF(ISERROR(VLOOKUP(RC[8],JobNotes!C[2]:C[6],2,FALSE)),"",IF(VLOOKUP(
RC[8],JobNotes!C[2]:C[6],2,FALSE)<"",VLOOKUP(H2,JobNotes!C[2]:C[6],2,FALSE)
,"")))"

I'm looking for the value found in the current sheet current row column "H",
to see if its in sheet <JobNotes column array "B:F", and if found, return
the contents of the cell in the second column of the array.



--
D.S.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default Run Time Error, FormulaR1C1

Hi Ds

"H2" is not a valid r1c1 address. Try replacing it with R2C8 and see if it helps.
-untested, sorry. It's a big scenario to set up for testing, that one.

--
HTH. Best wishes Harald
Followup to newsgroup only please.

"D.S." wrote in message
...
I have two sheets in the same workbook. In the first sheet, I'm trying to
programmatically populate cells with formulae to insure the correct formula
is always in the cells. The cell is too the left of a MSQuery, and the
formulae are not copying down along with the query refresh. When the code
runs, I'm getting a <run time error at this line.

Range("A2").FormulaR1C1 =
"=UPPER(IF(ISERROR(VLOOKUP(RC[8],JobNotes!C[2]:C[6],2,FALSE)),"",IF(VLOOKUP(
RC[8],JobNotes!C[2]:C[6],2,FALSE)<"",VLOOKUP(H2,JobNotes!C[2]:C[6],2,FALSE)
,"")))"

I'm looking for the value found in the current sheet current row column "H",
to see if its in sheet <JobNotes column array "B:F", and if found, return
the contents of the cell in the second column of the array.



--
D.S.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default Run Time Error, FormulaR1C1

That did need corrected, but still getting the run time error. Present code
is as follows:

Range("A2").FormulaR1C1 =
"=UPPER(IF(ISERROR(VLOOKUP(R[2]C[8],JobNotes!C[2]:C[6],2,FALSE)),"",IF(VLOOK
UP(R[2]C[8],JobNotes!C[2]:C[6],2,FALSE)<"",VLOOKUP(R[2]C[8],JobNotes!C[2]:C
[6],2,FALSE),"")))"

D.S.

"Harald Staff" wrote in message
...
Hi Ds

"H2" is not a valid r1c1 address. Try replacing it with R2C8 and see if it

helps.
-untested, sorry. It's a big scenario to set up for testing, that one.

--
HTH. Best wishes Harald
Followup to newsgroup only please.

"D.S." wrote in message
...
I have two sheets in the same workbook. In the first sheet, I'm trying

to
programmatically populate cells with formulae to insure the correct

formula
is always in the cells. The cell is too the left of a MSQuery, and the
formulae are not copying down along with the query refresh. When the

code
runs, I'm getting a <run time error at this line.

Range("A2").FormulaR1C1 =

"=UPPER(IF(ISERROR(VLOOKUP(RC[8],JobNotes!C[2]:C[6],2,FALSE)),"",IF(VLOOKUP(

RC[8],JobNotes!C[2]:C[6],2,FALSE)<"",VLOOKUP(H2,JobNotes!C[2]:C[6],2,FALSE)
,"")))"

I'm looking for the value found in the current sheet current row column

"H",
to see if its in sheet <JobNotes column array "B:F", and if found,

return
the contents of the cell in the second column of the array.



--
D.S.






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Run Time Error, FormulaR1C1

you need to double up on your double quotes embedded in the string

Sub Tester1()
Dim sStr as String
sStr =
"=UPPER(IF(ISERROR(VLOOKUP(R[2]C[8],JobNotes!C[2]:C[6],2,FALSE)),"""",IF(VLO
OKUP(R[2]C[8],JobNotes!C[2]:C[6],2,FALSE)<"""",VLOOKUP(R[2]C[8],JobNotes!C[
2]:C[6],2,FALSE),"""")))"
Range("A2").FormulaR1C1 = sStr

End Sub

At leasted entered successfully for me.

--
Regards,
Tom Ogilvy

D.S. wrote in message
...
That did need corrected, but still getting the run time error. Present

code
is as follows:

Range("A2").FormulaR1C1 =

"=UPPER(IF(ISERROR(VLOOKUP(R[2]C[8],JobNotes!C[2]:C[6],2,FALSE)),"""",IF(VLO
OK

UP(R[2]C[8],JobNotes!C[2]:C[6],2,FALSE)<"""",VLOOKUP(R[2]C[8],JobNotes!C[2]
:C
[6],2,FALSE),"""")))"

D.S.

"Harald Staff" wrote in message
...
Hi Ds

"H2" is not a valid r1c1 address. Try replacing it with R2C8 and see if

it
helps.
-untested, sorry. It's a big scenario to set up for testing, that one.

--
HTH. Best wishes Harald
Followup to newsgroup only please.

"D.S." wrote in message
...
I have two sheets in the same workbook. In the first sheet, I'm

trying
to
programmatically populate cells with formulae to insure the correct

formula
is always in the cells. The cell is too the left of a MSQuery, and the
formulae are not copying down along with the query refresh. When the

code
runs, I'm getting a <run time error at this line.

Range("A2").FormulaR1C1 =


"=UPPER(IF(ISERROR(VLOOKUP(RC[8],JobNotes!C[2]:C[6],2,FALSE)),"",IF(VLOOKUP(


RC[8],JobNotes!C[2]:C[6],2,FALSE)<"",VLOOKUP(H2,JobNotes!C[2]:C[6],2,FALSE)
,"")))"

I'm looking for the value found in the current sheet current row

column
"H",
to see if its in sheet <JobNotes column array "B:F", and if found,

return
the contents of the cell in the second column of the array.



--
D.S.








  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default Run Time Error, FormulaR1C1

Thanks Tom, thought the quotes were doubled. I did change the colum
references though. This seems to give me the exact result I'm looking for,
but don't understand why I had to change my colum reference in the
'JobNotes' sheet to C[1]:C[5] to look at columns B:F, would think that
should be C[2]:C[6]

I also added the <No in the double quotes, to give a more visual
confermation that the data was not found.

Range("A2").FormulaR1C1 =
"=UPPER(IF(ISERROR(VLOOKUP(RC[7],JobNotes!C[1]:C[5],2,FALSE)),""No"",IF(VLOO
KUP(RC[7],JobNotes!C[1]:C[5],2,FALSE)<"""",VLOOKUP(RC[7],JobNotes!C[1]:C[5]
,2,FALSE),""No"")))"

"Tom Ogilvy" wrote in message
...
you need to double up on your double quotes embedded in the string

Sub Tester1()
Dim sStr as String
sStr =

"=UPPER(IF(ISERROR(VLOOKUP(R[2]C[8],JobNotes!C[2]:C[6],2,FALSE)),"""",IF(VLO

OKUP(R[2]C[8],JobNotes!C[2]:C[6],2,FALSE)<"""",VLOOKUP(R[2]C[8],JobNotes!C[
2]:C[6],2,FALSE),"""")))"
Range("A2").FormulaR1C1 = sStr

End Sub

At leasted entered successfully for me.

--
Regards,
Tom Ogilvy

D.S. wrote in message
...
That did need corrected, but still getting the run time error. Present

code
is as follows:

Range("A2").FormulaR1C1 =


"=UPPER(IF(ISERROR(VLOOKUP(R[2]C[8],JobNotes!C[2]:C[6],2,FALSE)),"""",IF(VLO
OK


UP(R[2]C[8],JobNotes!C[2]:C[6],2,FALSE)<"""",VLOOKUP(R[2]C[8],JobNotes!C[2]
:C
[6],2,FALSE),"""")))"

D.S.

"Harald Staff" wrote in message
...
Hi Ds

"H2" is not a valid r1c1 address. Try replacing it with R2C8 and see

if
it
helps.
-untested, sorry. It's a big scenario to set up for testing, that one.

--
HTH. Best wishes Harald
Followup to newsgroup only please.

"D.S." wrote in message
...
I have two sheets in the same workbook. In the first sheet, I'm

trying
to
programmatically populate cells with formulae to insure the correct

formula
is always in the cells. The cell is too the left of a MSQuery, and

the
formulae are not copying down along with the query refresh. When

the
code
runs, I'm getting a <run time error at this line.

Range("A2").FormulaR1C1 =



"=UPPER(IF(ISERROR(VLOOKUP(RC[8],JobNotes!C[2]:C[6],2,FALSE)),"",IF(VLOOKUP(



RC[8],JobNotes!C[2]:C[6],2,FALSE)<"",VLOOKUP(H2,JobNotes!C[2]:C[6],2,FALSE)
,"")))"

I'm looking for the value found in the current sheet current row

column
"H",
to see if its in sheet <JobNotes column array "B:F", and if found,

return
the contents of the cell in the second column of the array.



--
D.S.












  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Run Time Error, FormulaR1C1

You might want to use: C2:C6


"D.S." wrote:

Thanks Tom, thought the quotes were doubled. I did change the colum
references though. This seems to give me the exact result I'm looking for,
but don't understand why I had to change my colum reference in the
'JobNotes' sheet to C[1]:C[5] to look at columns B:F, would think that
should be C[2]:C[6]

I also added the <No in the double quotes, to give a more visual
confermation that the data was not found.

Range("A2").FormulaR1C1 =
"=UPPER(IF(ISERROR(VLOOKUP(RC[7],JobNotes!C[1]:C[5],2,FALSE)),""No"",IF(VLOO
KUP(RC[7],JobNotes!C[1]:C[5],2,FALSE)<"""",VLOOKUP(RC[7],JobNotes!C[1]:C[5]
,2,FALSE),""No"")))"

"Tom Ogilvy" wrote in message
...
you need to double up on your double quotes embedded in the string

Sub Tester1()
Dim sStr as String
sStr =

"=UPPER(IF(ISERROR(VLOOKUP(R[2]C[8],JobNotes!C[2]:C[6],2,FALSE)),"""",IF(VLO

OKUP(R[2]C[8],JobNotes!C[2]:C[6],2,FALSE)<"""",VLOOKUP(R[2]C[8],JobNotes!C[
2]:C[6],2,FALSE),"""")))"
Range("A2").FormulaR1C1 = sStr

End Sub

At leasted entered successfully for me.

--
Regards,
Tom Ogilvy

D.S. wrote in message
...
That did need corrected, but still getting the run time error. Present

code
is as follows:

Range("A2").FormulaR1C1 =


"=UPPER(IF(ISERROR(VLOOKUP(R[2]C[8],JobNotes!C[2]:C[6],2,FALSE)),"""",IF(VLO
OK


UP(R[2]C[8],JobNotes!C[2]:C[6],2,FALSE)<"""",VLOOKUP(R[2]C[8],JobNotes!C[2]
:C
[6],2,FALSE),"""")))"

D.S.

"Harald Staff" wrote in message
...
Hi Ds

"H2" is not a valid r1c1 address. Try replacing it with R2C8 and see

if
it
helps.
-untested, sorry. It's a big scenario to set up for testing, that one.

--
HTH. Best wishes Harald
Followup to newsgroup only please.

"D.S." wrote in message
...
I have two sheets in the same workbook. In the first sheet, I'm

trying
to
programmatically populate cells with formulae to insure the correct
formula
is always in the cells. The cell is too the left of a MSQuery, and

the
formulae are not copying down along with the query refresh. When

the
code
runs, I'm getting a <run time error at this line.

Range("A2").FormulaR1C1 =



"=UPPER(IF(ISERROR(VLOOKUP(RC[8],JobNotes!C[2]:C[6],2,FALSE)),"",IF(VLOOKUP(



RC[8],JobNotes!C[2]:C[6],2,FALSE)<"",VLOOKUP(H2,JobNotes!C[2]:C[6],2,FALSE)
,"")))"

I'm looking for the value found in the current sheet current row

column
"H",
to see if its in sheet <JobNotes column array "B:F", and if found,
return
the contents of the cell in the second column of the array.



--
D.S.









--

Dave Peterson

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Run Time Error, FormulaR1C1

I should have added that c[2]:c[6] are relative references. It'd doesn't always
represent columns B:F. It represents the column 2 (to 6) to the right of the
cell that holds the formula.

Dave Peterson wrote:

You might want to use: C2:C6

"D.S." wrote:

Thanks Tom, thought the quotes were doubled. I did change the colum
references though. This seems to give me the exact result I'm looking for,
but don't understand why I had to change my colum reference in the
'JobNotes' sheet to C[1]:C[5] to look at columns B:F, would think that
should be C[2]:C[6]

I also added the <No in the double quotes, to give a more visual
confermation that the data was not found.

Range("A2").FormulaR1C1 =
"=UPPER(IF(ISERROR(VLOOKUP(RC[7],JobNotes!C[1]:C[5],2,FALSE)),""No"",IF(VLOO
KUP(RC[7],JobNotes!C[1]:C[5],2,FALSE)<"""",VLOOKUP(RC[7],JobNotes!C[1]:C[5]
,2,FALSE),""No"")))"

"Tom Ogilvy" wrote in message
...
you need to double up on your double quotes embedded in the string

Sub Tester1()
Dim sStr as String
sStr =

"=UPPER(IF(ISERROR(VLOOKUP(R[2]C[8],JobNotes!C[2]:C[6],2,FALSE)),"""",IF(VLO

OKUP(R[2]C[8],JobNotes!C[2]:C[6],2,FALSE)<"""",VLOOKUP(R[2]C[8],JobNotes!C[
2]:C[6],2,FALSE),"""")))"
Range("A2").FormulaR1C1 = sStr

End Sub

At leasted entered successfully for me.

--
Regards,
Tom Ogilvy

D.S. wrote in message
...
That did need corrected, but still getting the run time error. Present
code
is as follows:

Range("A2").FormulaR1C1 =


"=UPPER(IF(ISERROR(VLOOKUP(R[2]C[8],JobNotes!C[2]:C[6],2,FALSE)),"""",IF(VLO
OK


UP(R[2]C[8],JobNotes!C[2]:C[6],2,FALSE)<"""",VLOOKUP(R[2]C[8],JobNotes!C[2]
:C
[6],2,FALSE),"""")))"

D.S.

"Harald Staff" wrote in message
...
Hi Ds

"H2" is not a valid r1c1 address. Try replacing it with R2C8 and see

if
it
helps.
-untested, sorry. It's a big scenario to set up for testing, that one.

--
HTH. Best wishes Harald
Followup to newsgroup only please.

"D.S." wrote in message
...
I have two sheets in the same workbook. In the first sheet, I'm
trying
to
programmatically populate cells with formulae to insure the correct
formula
is always in the cells. The cell is too the left of a MSQuery, and

the
formulae are not copying down along with the query refresh. When

the
code
runs, I'm getting a <run time error at this line.

Range("A2").FormulaR1C1 =



"=UPPER(IF(ISERROR(VLOOKUP(RC[8],JobNotes!C[2]:C[6],2,FALSE)),"",IF(VLOOKUP(



RC[8],JobNotes!C[2]:C[6],2,FALSE)<"",VLOOKUP(H2,JobNotes!C[2]:C[6],2,FALSE)
,"")))"

I'm looking for the value found in the current sheet current row
column
"H",
to see if its in sheet <JobNotes column array "B:F", and if found,
return
the contents of the cell in the second column of the array.



--
D.S.









--

Dave Peterson


--

Dave Peterson

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Run Time Error, FormulaR1C1

Just to add:
Your using relative references - so you will get results based on whatever
the activecell is. Use absolute references as Dave suggests.

--
Regards,
Tom Ogilvy


D.S. wrote in message
...
Thanks Tom, thought the quotes were doubled. I did change the colum
references though. This seems to give me the exact result I'm looking for,
but don't understand why I had to change my colum reference in the
'JobNotes' sheet to C[1]:C[5] to look at columns B:F, would think that
should be C[2]:C[6]

I also added the <No in the double quotes, to give a more visual
confermation that the data was not found.

Range("A2").FormulaR1C1 =

"=UPPER(IF(ISERROR(VLOOKUP(RC[7],JobNotes!C[1]:C[5],2,FALSE)),""No"",IF(VLOO

KUP(RC[7],JobNotes!C[1]:C[5],2,FALSE)<"""",VLOOKUP(RC[7],JobNotes!C[1]:C[5]
,2,FALSE),""No"")))"

"Tom Ogilvy" wrote in message
...
you need to double up on your double quotes embedded in the string

Sub Tester1()
Dim sStr as String
sStr =


"=UPPER(IF(ISERROR(VLOOKUP(R[2]C[8],JobNotes!C[2]:C[6],2,FALSE)),"""",IF(VLO


OKUP(R[2]C[8],JobNotes!C[2]:C[6],2,FALSE)<"""",VLOOKUP(R[2]C[8],JobNotes!C[
2]:C[6],2,FALSE),"""")))"
Range("A2").FormulaR1C1 = sStr

End Sub

At leasted entered successfully for me.

--
Regards,
Tom Ogilvy

D.S. wrote in message
...
That did need corrected, but still getting the run time error.

Present
code
is as follows:

Range("A2").FormulaR1C1 =



"=UPPER(IF(ISERROR(VLOOKUP(R[2]C[8],JobNotes!C[2]:C[6],2,FALSE)),"""",IF(VLO
OK



UP(R[2]C[8],JobNotes!C[2]:C[6],2,FALSE)<"""",VLOOKUP(R[2]C[8],JobNotes!C[2]
:C
[6],2,FALSE),"""")))"

D.S.

"Harald Staff" wrote in message
...
Hi Ds

"H2" is not a valid r1c1 address. Try replacing it with R2C8 and see

if
it
helps.
-untested, sorry. It's a big scenario to set up for testing, that

one.

--
HTH. Best wishes Harald
Followup to newsgroup only please.

"D.S." wrote in message
...
I have two sheets in the same workbook. In the first sheet, I'm

trying
to
programmatically populate cells with formulae to insure the

correct
formula
is always in the cells. The cell is too the left of a MSQuery, and

the
formulae are not copying down along with the query refresh. When

the
code
runs, I'm getting a <run time error at this line.

Range("A2").FormulaR1C1 =




"=UPPER(IF(ISERROR(VLOOKUP(RC[8],JobNotes!C[2]:C[6],2,FALSE)),"",IF(VLOOKUP(




RC[8],JobNotes!C[2]:C[6],2,FALSE)<"",VLOOKUP(H2,JobNotes!C[2]:C[6],2,FALSE)
,"")))"

I'm looking for the value found in the current sheet current row

column
"H",
to see if its in sheet <JobNotes column array "B:F", and if

found,
return
the contents of the cell in the second column of the array.



--
D.S.












  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default Run Time Error, FormulaR1C1

Thanks to all, didn't dawn on me that it was a relative reference, I was
thinking it was an absolute reference. Lots of help, thanks again.

D.S.


"Tom Ogilvy" wrote in message
...
Just to add:
Your using relative references - so you will get results based on whatever
the activecell is. Use absolute references as Dave suggests.

--
Regards,
Tom Ogilvy


D.S. wrote in message
...
Thanks Tom, thought the quotes were doubled. I did change the colum
references though. This seems to give me the exact result I'm looking

for,
but don't understand why I had to change my colum reference in the
'JobNotes' sheet to C[1]:C[5] to look at columns B:F, would think that
should be C[2]:C[6]

I also added the <No in the double quotes, to give a more visual
confermation that the data was not found.

Range("A2").FormulaR1C1 =


"=UPPER(IF(ISERROR(VLOOKUP(RC[7],JobNotes!C[1]:C[5],2,FALSE)),""No"",IF(VLOO


KUP(RC[7],JobNotes!C[1]:C[5],2,FALSE)<"""",VLOOKUP(RC[7],JobNotes!C[1]:C[5]
,2,FALSE),""No"")))"

"Tom Ogilvy" wrote in message
...
you need to double up on your double quotes embedded in the string

Sub Tester1()
Dim sStr as String
sStr =



"=UPPER(IF(ISERROR(VLOOKUP(R[2]C[8],JobNotes!C[2]:C[6],2,FALSE)),"""",IF(VLO



OKUP(R[2]C[8],JobNotes!C[2]:C[6],2,FALSE)<"""",VLOOKUP(R[2]C[8],JobNotes!C[
2]:C[6],2,FALSE),"""")))"
Range("A2").FormulaR1C1 = sStr

End Sub

At leasted entered successfully for me.

--
Regards,
Tom Ogilvy

D.S. wrote in message
...
That did need corrected, but still getting the run time error.

Present
code
is as follows:

Range("A2").FormulaR1C1 =




"=UPPER(IF(ISERROR(VLOOKUP(R[2]C[8],JobNotes!C[2]:C[6],2,FALSE)),"""",IF(VLO
OK




UP(R[2]C[8],JobNotes!C[2]:C[6],2,FALSE)<"""",VLOOKUP(R[2]C[8],JobNotes!C[2]
:C
[6],2,FALSE),"""")))"

D.S.

"Harald Staff" wrote in message
...
Hi Ds

"H2" is not a valid r1c1 address. Try replacing it with R2C8 and

see
if
it
helps.
-untested, sorry. It's a big scenario to set up for testing, that

one.

--
HTH. Best wishes Harald
Followup to newsgroup only please.

"D.S." wrote in message
...
I have two sheets in the same workbook. In the first sheet, I'm
trying
to
programmatically populate cells with formulae to insure the

correct
formula
is always in the cells. The cell is too the left of a MSQuery,

and
the
formulae are not copying down along with the query refresh.

When
the
code
runs, I'm getting a <run time error at this line.

Range("A2").FormulaR1C1 =





"=UPPER(IF(ISERROR(VLOOKUP(RC[8],JobNotes!C[2]:C[6],2,FALSE)),"",IF(VLOOKUP(





RC[8],JobNotes!C[2]:C[6],2,FALSE)<"",VLOOKUP(H2,JobNotes!C[2]:C[6],2,FALSE)
,"")))"

I'm looking for the value found in the current sheet current row
column
"H",
to see if its in sheet <JobNotes column array "B:F", and if

found,
return
the contents of the cell in the second column of the array.



--
D.S.














  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default Run Time Error, FormulaR1C1

Ouch. Should have spotted that one. Sorry, and thank you Tom.

Best wishes Harald
Followup to newsgroup only please

"Tom Ogilvy" skrev i melding
...
you need to double up on your double quotes embedded in the string



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
ActiveCell.FormulaR1C1 Rick Excel Discussion (Misc queries) 3 March 28th 10 10:36 PM
FormulaR1C1 D.S.[_3_] Excel Programming 2 January 2nd 04 12:03 AM
FormulaR1C1 D.S.[_3_] Excel Programming 0 January 1st 04 09:12 PM
FormulaR1C1 aapp81[_22_] Excel Programming 3 December 3rd 03 10:47 PM
ActiveCell.FormulaR1C1 Leif Rasmussen Excel Programming 1 October 16th 03 09:46 AM


All times are GMT +1. The time now is 08:21 PM.

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

About Us

"It's about Microsoft Excel"