Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bob Bob is offline
external usenet poster
 
Posts: 972
Default Referencing 2 cells in a macro

I've got the following code which I am trying to add the following 2 columns
thru cell refences and am getting a compile error. I am not sure what I am
doing wrong since it works when I only reference 1 column.

Worksheets(Sh).Range("W" & X).FormulaR1C1 = "=((RC[" &
Sheet(1).Range("D32")+ RC[" & Sheet(1).Range("E32")& "]/Sheet1!R21C4*52)"

--
Thanks.

Bob
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 186
Default Referencing 2 cells in a macro

Hi Bob,
Ken again.
You are missing a quote before the RC in the second line of the your posted
code.

Sheet(1).Range("D32")+ "RC[" & Sheet(1).Range("E32")& "]/Sheet1!R21C4*52)"
--
Ken Hudson


"Bob" wrote:

I've got the following code which I am trying to add the following 2 columns
thru cell refences and am getting a compile error. I am not sure what I am
doing wrong since it works when I only reference 1 column.

Worksheets(Sh).Range("W" & X).FormulaR1C1 = "=((RC[" &
Sheet(1).Range("D32")+ RC[" & Sheet(1).Range("E32")& "]/Sheet1!R21C4*52)"

--
Thanks.

Bob

  #3   Report Post  
Posted to microsoft.public.excel.programming
Bob Bob is offline
external usenet poster
 
Posts: 972
Default Referencing 2 cells in a macro

Hi Ken,
I re-ran the code and came up with a "Type Mismatch" error. Not sure why

Worksheets(Sh).Range("W" & X) = "=((RC[" & Sheets(1).Range("D32") + "RC[" &
Sheets(1).Range("E32") & "]/Sheet1!R25C4*52)"

Thanks.

Bob






Worksheets(Sh).Range("W" & X) = "=((RC[" & Sheets(1).Range("D32") + "RC[" &
Sheets(1).Range("E32") & "]/Sheet1!R25C4*52"
--
Bob


"Ken Hudson" wrote:

Hi Bob,
Ken again.
You are missing a quote before the RC in the second line of the your posted
code.


--
Ken Hudson


"Bob" wrote:

I've got the following code which I am trying to add the following 2 columns
thru cell refences and am getting a compile error. I am not sure what I am
doing wrong since it works when I only reference 1 column.

Worksheets(Sh).Range("W" & X).FormulaR1C1 = "=((RC[" &
Sheet(1).Range("D32")+ RC[" & Sheet(1).Range("E32")& "]/Sheet1!R21C4*52)"

--
Thanks.

Bob

  #4   Report Post  
Posted to microsoft.public.excel.programming
Bob Bob is offline
external usenet poster
 
Posts: 972
Default Referencing 2 cells in a macro

Thanks - I got it to run.
--
Bob


"Bob" wrote:

Hi Ken,
I re-ran the code and came up with a "Type Mismatch" error. Not sure why

Worksheets(Sh).Range("W" & X) = "=((RC[" & Sheets(1).Range("D32") + "RC[" &
Sheets(1).Range("E32") & "]/Sheet1!R25C4*52)"

Thanks.

Bob






Worksheets(Sh).Range("W" & X) = "=((RC[" & Sheets(1).Range("D32") + "RC[" &
Sheets(1).Range("E32") & "]/Sheet1!R25C4*52"
--
Bob


"Ken Hudson" wrote:

Hi Bob,
Ken again.
You are missing a quote before the RC in the second line of the your posted
code.


--
Ken Hudson


"Bob" wrote:

I've got the following code which I am trying to add the following 2 columns
thru cell refences and am getting a compile error. I am not sure what I am
doing wrong since it works when I only reference 1 column.

Worksheets(Sh).Range("W" & X).FormulaR1C1 = "=((RC[" &
Sheet(1).Range("D32")+ RC[" & Sheet(1).Range("E32")& "]/Sheet1!R21C4*52)"

--
Thanks.

Bob

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
referencing cells based on conditions in other cells mirskman Excel Discussion (Misc queries) 1 January 29th 09 09:57 PM
Referencing the same cells Kenton Excel Discussion (Misc queries) 6 November 25th 08 09:57 PM
Referencing cells cate New Users to Excel 3 April 26th 06 08:34 PM
referencing previously selected cells after macro execution begins Glenn Excel Programming 5 October 15th 04 12:52 AM
Referencing Cells Sok Hong Excel Programming 1 August 5th 03 02:28 PM


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