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: 41
Default Insert Formula in cells from VBA

Hi,
I have different data related together on a sheet.
I want to create a formula selecting the function depending the code I have
in cell A7
The formula in all cell should be like this
= Choose(A7,ATV,Connect,Sales,Hours, Closing)

Each option (ATV, Connect, etc) = "a function I need to create for each case"

In case the user select "1" in cell A7 to increase the ATV, the cell should
use the function ATV
Using a relative reference so I can use it everywhere
I tried this:

Function ATV()
ActiveCell.FormulaR1C1 = "=Average (RC[-3:RC[-1])"
End Function

This mean calculate the average of the last 3 columns (months)

For testing in cell AL67 instead of
= Choose(A7,ATV,Connect,Sales,Hours, Closing)
I use directly
=ATV()

I tried also =ATV(AL67)

What I need to see is the answer of the formula =Average (RC[-3:RC[-1])
when in the cell I have =ATV function

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
Insert formula and copy to a range of cells above mickjjuk Excel Programming 2 December 4th 09 03:00 PM
Blocked from Inserting individual cells or Insert Cut Cells Ching-AHS Excel Discussion (Misc queries) 0 December 1st 09 05:47 PM
Help with the formula to insert cells Igneshwara reddy[_2_] Excel Worksheet Functions 5 March 23rd 07 05:14 PM
Insert Formula and Copy to other cells [email protected] Excel Discussion (Misc queries) 1 August 12th 05 08:51 PM
How to insert formula to a range of cells from VBA? crapit Excel Programming 10 March 18th 05 01:38 PM


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