This one has me buffaloed. Here is the VBA to multiply two (computed) columns together and then copy the formula across the row:
Worksheets("Portfolio").ActivateRange(Cells(counter + 6, 5), Cells(counter + 6, 5)).Select
Selection.FormulaArray = "= SUM(R[-" & (counter + 2) & "]C4:R[-3]C4 * R[-" & _
(counter + 2) & "]C:R[-3]C)"
Selection.Copy
Range(Cells(counter + 6, 6), Cells(counter + 6, 12)).PasteSpecial xlPasteFormulas
What happens is the formula gets created in the correct row of the Portfolio sheet as desired, EXCEPT that R6C6 (the first pasted value) gives the same answer as R6C5. The other pasted values are fine. If I go to the sheet, copy the formula in R6C5, then do a ctrl-shift-return paste into R6C6, it does the right calculation. I have tried FillRight, I have tried everything, and I cannot seem to make that first copied cell behave.
All of the formulas look correct when examined, i.e., when you look at them in the Portfolio sheet. What is happening is the pasted formula for some reason is not getting pasted as a proper formula. Why would just that first pasted value be incorrect???? Ideas appreciated!
Worksheets("Portfolio").ActivateRange(Cells(counter + 6, 5), Cells(counter + 6, 5)).Select
Selection.FormulaArray = "= SUM(R[-" & (counter + 2) & "]C4:R[-3]C4 * R[-" & _
(counter + 2) & "]C:R[-3]C)"
Selection.Copy
Range(Cells(counter + 6, 6), Cells(counter + 6, 12)).PasteSpecial xlPasteFormulas
What happens is the formula gets created in the correct row of the Portfolio sheet as desired, EXCEPT that R6C6 (the first pasted value) gives the same answer as R6C5. The other pasted values are fine. If I go to the sheet, copy the formula in R6C5, then do a ctrl-shift-return paste into R6C6, it does the right calculation. I have tried FillRight, I have tried everything, and I cannot seem to make that first copied cell behave.
All of the formulas look correct when examined, i.e., when you look at them in the Portfolio sheet. What is happening is the pasted formula for some reason is not getting pasted as a proper formula. Why would just that first pasted value be incorrect???? Ideas appreciated!