Hi
Selection.FormulaArray = _
"=SUM(IF(SMAST2!R2C92:R10976C92=""A"",1,0))"
The above line comes out of a macro i use to sum the number of products in a list assigned an "A" in the range, (row 2 -> row 10976, column 92).
The formula works well, i got it by using the record mode.
Question:
Lets say 10 more products are added onto the list. Rather than using find and replace to change 10976 to 10986 in the code each time. Is there a way to use a variable for the number of rows and then insert this variable into the formula?
eg.
"=SUM(IF(SMAST2!R2C92:R**"Variable" or "object"**C92=""A"",1,0))"
If this is not possible, is it because the formula is in an excel notation and not strictly VBA?
Do i need to reference the rows and columns differently?
I've tried looking at the, "How can i rename a table as it changes size?" FAQ and it doesnt really help.
Any help would be very much appreciated.
Thanks
Selection.FormulaArray = _
"=SUM(IF(SMAST2!R2C92:R10976C92=""A"",1,0))"
The above line comes out of a macro i use to sum the number of products in a list assigned an "A" in the range, (row 2 -> row 10976, column 92).
The formula works well, i got it by using the record mode.
Question:
Lets say 10 more products are added onto the list. Rather than using find and replace to change 10976 to 10986 in the code each time. Is there a way to use a variable for the number of rows and then insert this variable into the formula?
eg.
"=SUM(IF(SMAST2!R2C92:R**"Variable" or "object"**C92=""A"",1,0))"
If this is not possible, is it because the formula is in an excel notation and not strictly VBA?
Do i need to reference the rows and columns differently?
I've tried looking at the, "How can i rename a table as it changes size?" FAQ and it doesnt really help.
Any help would be very much appreciated.
Thanks