Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Stefi
 
Posts: n/a
Default reference to other worksheets in FormulaR1C1

Hi All,
I want to create a formula:
ActiveCell.FormulaR1C1 = "=SUM('01'!RC[-54],'02'!RC[-54],'03'!RC[-54])"
where '01', '02', '03' are worksheet names in the same workbook. Recording a
macro gives the same reference format to other sheets in the workbook. If I
create this formula manually, it works after re-opening the workbook.

However, if I create the formula with the line above, Excel interprets the
'01'!, '02!', '03!' references as those to other workBOOKS instead of
workSHEETS. It informs me that the workbook contains references to other
workbooks, and it asks me if I want to refresh ... .
What's wrong? How can I create a workSHEET reference with
ActiveCell.FormulaR1C1?

Thanks!
Stefi


  #2   Report Post  
Duke Carey
 
Posts: n/a
Default

What happends if you change your formula to

=SUM('01:03'!RC[-54])


"Stefi" wrote:

Hi All,
I want to create a formula:
ActiveCell.FormulaR1C1 = "=SUM('01'!RC[-54],'02'!RC[-54],'03'!RC[-54])"
where '01', '02', '03' are worksheet names in the same workbook. Recording a
macro gives the same reference format to other sheets in the workbook. If I
create this formula manually, it works after re-opening the workbook.

However, if I create the formula with the line above, Excel interprets the
'01'!, '02!', '03!' references as those to other workBOOKS instead of
workSHEETS. It informs me that the workbook contains references to other
workbooks, and it asks me if I want to refresh ... .
What's wrong? How can I create a workSHEET reference with
ActiveCell.FormulaR1C1?

Thanks!
Stefi


  #3   Report Post  
Stefi
 
Posts: n/a
Default

It's worse:

=SUM('01:[03]03'!RC[-54])

This is the resulted formula, and it gives (of course) #REF error.

Stefi

€˛Duke Carey€¯ ezt Ć*rta:

What happends if you change your formula to

=SUM('01:03'!RC[-54])


"Stefi" wrote:

Hi All,
I want to create a formula:
ActiveCell.FormulaR1C1 = "=SUM('01'!RC[-54],'02'!RC[-54],'03'!RC[-54])"
where '01', '02', '03' are worksheet names in the same workbook. Recording a
macro gives the same reference format to other sheets in the workbook. If I
create this formula manually, it works after re-opening the workbook.

However, if I create the formula with the line above, Excel interprets the
'01'!, '02!', '03!' references as those to other workBOOKS instead of
workSHEETS. It informs me that the workbook contains references to other
workbooks, and it asks me if I want to refresh ... .
What's wrong? How can I create a workSHEET reference with
ActiveCell.FormulaR1C1?

Thanks!
Stefi


  #4   Report Post  
Stefi
 
Posts: n/a
Default

Besides it informs me that the workbook contains references to other
workbooks, and it asks me if I want to refresh ... .
Stefi

€˛Stefi€¯ ezt Ć*rta:

It's worse:

=SUM('01:[03]03'!RC[-54])

This is the resulted formula, and it gives (of course) #REF error.

Stefi

€˛Duke Carey€¯ ezt Ć*rta:

What happends if you change your formula to

=SUM('01:03'!RC[-54])


"Stefi" wrote:

Hi All,
I want to create a formula:
ActiveCell.FormulaR1C1 = "=SUM('01'!RC[-54],'02'!RC[-54],'03'!RC[-54])"
where '01', '02', '03' are worksheet names in the same workbook. Recording a
macro gives the same reference format to other sheets in the workbook. If I
create this formula manually, it works after re-opening the workbook.

However, if I create the formula with the line above, Excel interprets the
'01'!, '02!', '03!' references as those to other workBOOKS instead of
workSHEETS. It informs me that the workbook contains references to other
workbooks, and it asks me if I want to refresh ... .
What's wrong? How can I create a workSHEET reference with
ActiveCell.FormulaR1C1?

Thanks!
Stefi


  #5   Report Post  
Duke Carey
 
Posts: n/a
Default

I'm just guessing now.

Does the formula work after you create it programmatically and before you
close the workbook? Are you sure the sheet is named zero-three and not
oh-three?

Do you have a workbook named 03?


"Stefi" wrote:

It's worse:

=SUM('01:[03]03'!RC[-54])

This is the resulted formula, and it gives (of course) #REF error.

Stefi

€˛Duke Carey€¯ ezt Ć*rta:

What happends if you change your formula to

=SUM('01:03'!RC[-54])


"Stefi" wrote:

Hi All,
I want to create a formula:
ActiveCell.FormulaR1C1 = "=SUM('01'!RC[-54],'02'!RC[-54],'03'!RC[-54])"
where '01', '02', '03' are worksheet names in the same workbook. Recording a
macro gives the same reference format to other sheets in the workbook. If I
create this formula manually, it works after re-opening the workbook.

However, if I create the formula with the line above, Excel interprets the
'01'!, '02!', '03!' references as those to other workBOOKS instead of
workSHEETS. It informs me that the workbook contains references to other
workbooks, and it asks me if I want to refresh ... .
What's wrong? How can I create a workSHEET reference with
ActiveCell.FormulaR1C1?

Thanks!
Stefi




  #6   Report Post  
peter147
 
Posts: n/a
Default

Stefi
You must identify the sheet '01' etc will just confuse VB
try the following
ActiveCell.FormulaR1C1 =
"=SUM('sheets01'!RC[-54],'sheets02'!RC[-54],'sheets03'!RC[-54])"

"Stefi" wrote:

Hi All,
I want to create a formula:
ActiveCell.FormulaR1C1 = "=SUM('01'!RC[-54],'02'!RC[-54],'03'!RC[-54])"
where '01', '02', '03' are worksheet names in the same workbook. Recording a
macro gives the same reference format to other sheets in the workbook. If I
create this formula manually, it works after re-opening the workbook.

However, if I create the formula with the line above, Excel interprets the
'01'!, '02!', '03!' references as those to other workBOOKS instead of
workSHEETS. It informs me that the workbook contains references to other
workbooks, and it asks me if I want to refresh ... .
What's wrong? How can I create a workSHEET reference with
ActiveCell.FormulaR1C1?

Thanks!
Stefi


  #7   Report Post  
Stefi
 
Posts: n/a
Default

Sorry boys,

I found out, that the problem was the following:
The sequence of the statements was wrong: creating the worksheets named 01,
02, 03 FOLLOWED the statement

ActiveCell.FormulaR1C1 = "=SUM('01'!RC[-54],'02'!RC[-54],'03'!RC[-54])"

so at the time of creating this formula the referred sheets did not exist yet!

Changing the sequence solved the problem.

However! It would be a more intelligent behaviour if in such a case Excel
would give an error message "The referred sheet does not exist" instead of
high-handedly changing the sheet-reference to workbook-reference, because
workbook-references are clearly distuinguished: [workbook-name]

Thanks!
Stefi


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
How Do I Get a date reference when linking excel worksheets? Shawn Lyons Excel Worksheet Functions 3 May 16th 05 05:48 PM
How do I reference values from 200 worksheets onto a summary sheet mac849 Excel Discussion (Misc queries) 4 March 17th 05 10:26 AM
Summarizing Data across Worksheets using a single reference Mugen123 Excel Worksheet Functions 1 February 25th 05 04:23 PM
HOW DO I REFERENCE A CELL FROM THE RESULTS OF TWO WORKSHEETS TD Excel Discussion (Misc queries) 1 December 14th 04 04:16 PM
HOW DO I REFERENCE A CELL FROM THE RESULTS OF TWO WORKSHEETS TD Excel Discussion (Misc queries) 0 December 14th 04 03:25 AM


All times are GMT +1. The time now is 05:01 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"