Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I sincerely appreciate whoever's help on this question!
I need to use Excel formula functions of COUNTIF and SUM in VBA. The range for calculation need to refer to a variable set in the VBA which is changing from one worksheet to another. However, the variable can't be recognized by the COUNTIF function. The actual statement is: Selection.Value = "=COUNTIF(RC[1 - C]:RC[- 1], ""Abs"")" or Activecell.FormulaR1C1 = "=COUNTIF(RC[1 - C]:RC[- 1], ""Abs"")" "C" is the variable set in VBA that has to be used for iteration steps in diferrent worksheet. How to make Excel function work by using the variable "C"? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
i use a trick, i save the value of the variable in cell A6000 and name it
[the cell] the same as the variable, then reference this cell in my formula. -- --- zz [MX] cuasi-musico,semi-poeta y loco "Terry" wrote in message ... I sincerely appreciate whoever's help on this question! I need to use Excel formula functions of COUNTIF and SUM in VBA. The range for calculation need to refer to a variable set in the VBA which is changing from one worksheet to another. However, the variable can't be recognized by the COUNTIF function. The actual statement is: Selection.Value = "=COUNTIF(RC[1 - C]:RC[- 1], ""Abs"")" or Activecell.FormulaR1C1 = "=COUNTIF(RC[1 - C]:RC[- 1], ""Abs"")" "C" is the variable set in VBA that has to be used for iteration steps in diferrent worksheet. How to make Excel function work by using the variable "C"? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you very much!
But the variable "C" is used to define one end of the range. if replaced by another range name, the COUNTIF function still can't recognize it. This function is aiming to count how many "ABC" within the left side (C-1) columns of the activecell. "C" is changing in different worksheets and activecell is is changing within one worksheet column. And, I must write it within VBA instead of worksheet because of the number of activecell need to get teh result is uncertain. Activecell.FormulaR1C1 = "=COUNTIF(RC[1 - C]:RC[- 1], ""Abs"")" "zz" wrote: i use a trick, i save the value of the variable in cell A6000 and name it [the cell] the same as the variable, then reference this cell in my formula. -- --- zz [MX] cuasi-musico,semi-poeta y loco "Terry" wrote in message ... I sincerely appreciate whoever's help on this question! I need to use Excel formula functions of COUNTIF and SUM in VBA. The range for calculation need to refer to a variable set in the VBA which is changing from one worksheet to another. However, the variable can't be recognized by the COUNTIF function. The actual statement is: Selection.Value = "=COUNTIF(RC[1 - C]:RC[- 1], ""Abs"")" or Activecell.FormulaR1C1 = "=COUNTIF(RC[1 - C]:RC[- 1], ""Abs"")" "C" is the variable set in VBA that has to be used for iteration steps in diferrent worksheet. How to make Excel function work by using the variable "C"? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Pls don't multipost. See ans in functions. -- Don Guillett SalesAid Software "Terry" wrote in message ... I sincerely appreciate whoever's help on this question! I need to use Excel formula functions of COUNTIF and SUM in VBA. The range for calculation need to refer to a variable set in the VBA which is changing from one worksheet to another. However, the variable can't be recognized by the COUNTIF function. The actual statement is: Selection.Value = "=COUNTIF(RC[1 - C]:RC[- 1], ""Abs"")" or Activecell.FormulaR1C1 = "=COUNTIF(RC[1 - C]:RC[- 1], ""Abs"")" "C" is the variable set in VBA that has to be used for iteration steps in diferrent worksheet. How to make Excel function work by using the variable "C"? |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Ok sorry
"Don Guillett" wrote: Pls don't multipost. See ans in functions. -- Don Guillett SalesAid Software "Terry" wrote in message ... I sincerely appreciate whoever's help on this question! I need to use Excel formula functions of COUNTIF and SUM in VBA. The range for calculation need to refer to a variable set in the VBA which is changing from one worksheet to another. However, the variable can't be recognized by the COUNTIF function. The actual statement is: Selection.Value = "=COUNTIF(RC[1 - C]:RC[- 1], ""Abs"")" or Activecell.FormulaR1C1 = "=COUNTIF(RC[1 - C]:RC[- 1], ""Abs"")" "C" is the variable set in VBA that has to be used for iteration steps in diferrent worksheet. How to make Excel function work by using the variable "C"? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Variable VBA Max Formula | Excel Discussion (Misc queries) | |||
formula containing a formula-dependent variable - how? | New Users to Excel | |||
Variable in formula | Excel Programming | |||
Using a variable in a VBA formula | Excel Discussion (Misc queries) | |||
Using a variable in a formula | Excel Programming |