Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to write an average formula from VBA- SHOULD BE SIMPLE!
Bob's formula will average ALL cells between B4 & E6 as you indicated with
(myRange1:myRange2). If you want just the Average of those 2 cells (myRange1, myRange2), then use: myAverage.Formula = "=Average(" & myRange1 & "," & myRange2 & ")" Mike F "Bob Phillips" wrote in message ... myAverage.formula = "=Average(" & myRange1.address & ":" & _ myRange2.address & ")" -- HTH Bob Phillips "cantonarv" wrote in message oups.com... I am trying to do the following : Dim myRange1 as range Dim myRange2 as range Dim myAverage as range 'set two ranges set myRange1= range(b4) set myRange2= range(e6) 'write into a cell an average formula myAverage.formula = "=Average(myRange1:myRange2)" Thats all!! However the part (myRange1:myRange2) is incorrect - whats the correct syntax to write this to the cell. Or if this cannot be done how do I get from numbers to alpha-numeric cell representation e.g. Cell(1,1) to Cell(A1) -whats the way of doing this is VBA Thanks in advance guys |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Write formula for simple copy and paste to another cell | Excel Worksheet Functions | |||
Calculated field in pivot table, simple Average formula | Excel Discussion (Misc queries) | |||
Help I need to know how to write a simple formula, not having any | Excel Discussion (Misc queries) | |||
simple average formula...can you solve it in principle? | Excel Discussion (Misc queries) | |||
help.. want write a simple marco | Excel Programming |