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: 4
Default Using .formular1c1 with the Range/Cells Method

Given a worksheet function that accepts a range of values, Average(Range),
for example.....

What is the method to use the .formulaR1C1 method within VBA to assign the
Average formula to a cell, assuming that I want to define the formula from
within VBA using the Range/Cells method(s).

Example:

Macro recorder provides the following code to define a cell using the
Average function:

ActiveCell.FormulaR1C1 = "=AVERAGE(R[-4]C[-2]:R[12]C[-2])"

Can this be done via something like:

Dim Rindex as Integer
Dim Cindex as Integer

Rindex=3
Cindex=7

strArg= "=" & Range(Cells(Rowindex, Colindex),Cells(Rowindex+7,Colindex))
ActiveCell.FormulaR1C1 = "=" & strArg

and have it parse correctly....

i.e. I would like to be able to manipulate the .FormulaR1C1 line via
variables that get worked upon prior to setting the formula in the cell.

Thank you in advance for the assistance.

--


Frank Bachman
(Grumpy Aero Guy)



 
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
Range and Cells method Jenny Excel Programming 1 January 5th 05 03:10 AM
Range.delete method Touk Excel Programming 1 September 28th 04 06:15 AM
Adding named range gives error "method range of object _Global failed " Gunnar Johansson Excel Programming 3 August 10th 04 01:54 PM
Pass a range to a method? Frank Kabel Excel Programming 12 May 21st 04 02:50 AM
Activecell.FormulaR1C1 Versus ActiveSheet.cells(column, row) Ashish Shridharan Excel Programming 2 February 15th 04 04:46 PM


All times are GMT +1. The time now is 12:10 PM.

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"