Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Excel: VB Macro programming problem with formula writing

I am trying to enter addresses of cells in one worksheet ("source_sheet")
into a matrix of cells in a separate worksheet ("dest_sheet") using a
formula. I am using a nested for loop to fill the appropriate cells in
"dest_sheet". The code works properly in that it writes to the proper cells
in "dest_sheet". It does not work properly in that the formulas that are
written into the cells do not reference the correct addresses.

my write statement inside the for loops is:

Cells(write_row + j, 7).Formula = "='" & source_sheet & "'!r[" & read_col &
"]c[" & read_row & "]"

The resulting addresses refer to the proper sheet ("source_sheet"), but the
addresses of the cells are not correct.

An example formula is:

='raw data 25C'!G3

where 'raw data 25C' is accurate but G3 is not.

Am I misusing the RC cell reference?

HELP!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Excel: VB Macro programming problem with formula writing

Someone helped me via e-mail:

I was using bracket notation and didn't realize that brackets inferred
relative addressing not absolute addressing.

"d-cubed" wrote:

I am trying to enter addresses of cells in one worksheet ("source_sheet")
into a matrix of cells in a separate worksheet ("dest_sheet") using a
formula. I am using a nested for loop to fill the appropriate cells in
"dest_sheet". The code works properly in that it writes to the proper cells
in "dest_sheet". It does not work properly in that the formulas that are
written into the cells do not reference the correct addresses.

my write statement inside the for loops is:

Cells(write_row + j, 7).Formula = "='" & source_sheet & "'!r[" & read_col &
"]c[" & read_row & "]"

The resulting addresses refer to the proper sheet ("source_sheet"), but the
addresses of the cells are not correct.

An example formula is:

='raw data 25C'!G3

where 'raw data 25C' is accurate but G3 is not.

Am I misusing the RC cell reference?

HELP!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Excel: VB Macro programming problem with formula writing

Cells(write_row + j, 7).Formula = "='" & source_sheet & "'!r[" & read_col
& "]c[" & read_row & "]"


Let's take a specific case. Say you're putting a formula in cell C3 and
that read_row is 2 and read_col is 1:

Cells(3, 3).Formula = "='" & source_sheet & "'!r[2]c[1]"

This says you want a cell 2 rows below C3 and 1 column to the right of C3
(aka D5) on the source sheet referenced.

What do you really want?

--
Jim
"d-cubed" wrote in message
...
|I am trying to enter addresses of cells in one worksheet ("source_sheet")
| into a matrix of cells in a separate worksheet ("dest_sheet") using a
| formula. I am using a nested for loop to fill the appropriate cells in
| "dest_sheet". The code works properly in that it writes to the proper
cells
| in "dest_sheet". It does not work properly in that the formulas that are
| written into the cells do not reference the correct addresses.
|
| my write statement inside the for loops is:
|
| Cells(write_row + j, 7).Formula = "='" & source_sheet & "'!r[" & read_col
&
| "]c[" & read_row & "]"
|
| The resulting addresses refer to the proper sheet ("source_sheet"), but
the
| addresses of the cells are not correct.
|
| An example formula is:
|
| ='raw data 25C'!G3
|
| where 'raw data 25C' is accurate but G3 is not.
|
| Am I misusing the RC cell reference?
|
| HELP!
|


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
Problem writing formula Alf[_13_] Excel Programming 3 July 5th 06 11:27 PM
Problem writing formula Millicent Excel Worksheet Functions 1 March 29th 06 02:26 AM
Formula writing problem Bob Excel Worksheet Functions 2 November 4th 05 10:33 PM
VB Macro writing a formula to a cell Neal Zimm Excel Programming 2 September 15th 05 08:09 PM
macro programming problem Dave Murto[_2_] Excel Programming 1 January 3rd 04 02:29 AM


All times are GMT +1. The time now is 03:05 AM.

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"