ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Implement CSE function through VBA with parameters (https://www.excelbanter.com/excel-worksheet-functions/18197-implement-cse-function-through-vba-parameters.html)

Bastanu

Implement CSE function through VBA with parameters
 
Would this type of solution be possible or do I have to do
my calculations in VBA?

I am trying to dynamically update a table based on a
combination of two paramaters.

So I need to add the formula below to a first month column
and then copy it to all the other months.
Can I do something like this in VBA:
strFormula = _
"{= SUM(IF(" & variable1 & " tl_transactions=$B11,IF(YEAR
(" & variable2 & " tl_transactions) & MONTH(& variable2
& " tl_transactions)=YEAR(D$9) & MONTH(D$9),tl_Net_Cost
tl_transactions,0),0))}

myRange.Formula=strFormula





Don Guillett

..formulaarray

--
Don Guillett
SalesAid Software

"Bastanu" wrote in message
...
Would this type of solution be possible or do I have to do
my calculations in VBA?

I am trying to dynamically update a table based on a
combination of two paramaters.

So I need to add the formula below to a first month column
and then copy it to all the other months.
Can I do something like this in VBA:
strFormula = _
"{= SUM(IF(" & variable1 & " tl_transactions=$B11,IF(YEAR
(" & variable2 & " tl_transactions) & MONTH(& variable2
& " tl_transactions)=YEAR(D$9) & MONTH(D$9),tl_Net_Cost
tl_transactions,0),0))}

myRange.Formula=strFormula







bastanu

Don,
Tried that but it doesn't work... I think the formulaarry wants an
actual array



All times are GMT +1. The time now is 09:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com