LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 217
Default Formula R1C1 in VBA - Strange Results (Dynamic)

Hi,

I have the following code in VBA to give me some variance % results.
Although the rows are always static the columns are not:

ActiveCell.FormulaR1C1 = "=SUM(R[-34]C-R[-17]C)/R[-17]C"
ActiveCell.Offset(1, 0).Select
ActiveCell.FormulaR1C1 = "=SUM(R[-32]C-R[-15]C)/R[-15]C"
ActiveCell.Offset(1, 0).Select
ActiveCell.FormulaR1C1 = "=SUM(R[-30]C-R[-13]C)/R[-13]C"

What I want this to do is to start in row 45, in the column i am in (worked
out prior to this in the macro) and put in a formula which basically in Excel
would read:

=SUM(I11-I28)/I28
then down one row
=SUM(I13-I30)/I30
then down one row
=SUM(I15-I32)/I32

This works, but only for the 1st and 3rd formulae, the second one is always
wrong by one row...

Am I doing something majorly wrong here?

Thanks,
 
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
Simple subtraction formula returning strange results = Excel glitc Ginger Excel Worksheet Functions 13 April 1st 09 07:12 PM
VLOOKUP formula results strange after copying down Code Numpty Excel Worksheet Functions 6 July 31st 08 12:18 AM
Use dynamic column reference without R1C1 Pontificateur Excel Worksheet Functions 3 February 4th 08 10:55 PM
Copy a R1C1 formula to a user defined range results #NAME? error mzehr Excel Programming 2 August 20th 07 08:50 PM
Dynamic Range in Macro with R1C1 Jonnyboy117 Excel Programming 3 July 9th 04 04:40 PM


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