Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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: Doesnt 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! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
macro not working with new sheet | Excel Discussion (Misc queries) | |||
MACRO IS NOT WORKING AS IT SHOULD | Excel Worksheet Functions | |||
macro not working | Excel Discussion (Misc queries) | |||
Formula within a Macro not working as expected. | New Users to Excel | |||
macro not working | Excel Discussion (Misc queries) |