C
Chloe
I am using Excel 2003. I am using variables to insert formulas into an excel
worksheet. I am using Row Count to flexibly describe the range in a sum,
median, & sum of the product. The sum of the product is working when I hard
code the column for both parts of the formula (feeding it the columns letter)
However, when I try to use one hard coded column part & the other relative
column, the formula returns with the hard coded part with surrounded single
quotes.
Here is the actual code:
Doesn’t work – returns =SUMPRODUCT('O14':'O22',(X15:X23))/SUM('O14':'O22')
This is the code:
ActiveCell.Offset(i + SemisRowCount - 1, 0).Value = "=sumproduct(" &
SemisBenchWgt & "," & SemisFormula & ")/sum(" & SemisBenchWgt & ")"
Variables
SemisBenchWgt = "O" & i + 4 & ":O" & i + SemisRowCount - 1
SemisFormula = "(R[" & -SemisRowCount + 4 & "]C:R[" & -1 & "]C)"
Works
This is the code:
ActiveCell.Offset(i + SemisRowCount + CompRowCount, 0).Value =
"=sumproduct(" & CompBenchWgt & "," & TgtComp & ")/sum(" & CompBenchWgt & ")"
Variables
CompBenchWgt = "O" & SemisRowCount + i + 5 & ":O" & SemisRowCount +
CompRowCount + i
TgtComp = "X" & SemisRowCount + i + 5 & ":X" & SemisRowCount + CompRowCount
+ i
Any help would be appreciated.
Thanks!
worksheet. I am using Row Count to flexibly describe the range in a sum,
median, & sum of the product. The sum of the product is working when I hard
code the column for both parts of the formula (feeding it the columns letter)
However, when I try to use one hard coded column part & the other relative
column, the formula returns with the hard coded part with surrounded single
quotes.
Here is the actual code:
Doesn’t work – returns =SUMPRODUCT('O14':'O22',(X15:X23))/SUM('O14':'O22')
This is the code:
ActiveCell.Offset(i + SemisRowCount - 1, 0).Value = "=sumproduct(" &
SemisBenchWgt & "," & SemisFormula & ")/sum(" & SemisBenchWgt & ")"
Variables
SemisBenchWgt = "O" & i + 4 & ":O" & i + SemisRowCount - 1
SemisFormula = "(R[" & -SemisRowCount + 4 & "]C:R[" & -1 & "]C)"
Works
This is the code:
ActiveCell.Offset(i + SemisRowCount + CompRowCount, 0).Value =
"=sumproduct(" & CompBenchWgt & "," & TgtComp & ")/sum(" & CompBenchWgt & ")"
Variables
CompBenchWgt = "O" & SemisRowCount + i + 5 & ":O" & SemisRowCount +
CompRowCount + i
TgtComp = "X" & SemisRowCount + i + 5 & ":X" & SemisRowCount + CompRowCount
+ i
Any help would be appreciated.
Thanks!