I'm creating an Excel Workbook from
VB and inserting some formulas (from
VB
into Excel).
The formulas are column specific and are
relative reference formulas. For example
oWB.ActiveSheet.Cells(row, "H").Formula = "=IF(B7=""B"", ((F7-D7) * C7 *
50), ((F7-D7) * C7 * 50))" 'Gross Profit
..
After insertion Excel shows a value for the formula, but the value is for
the first row inserted. All subsequent rows contain the same formula and
EXCEL does NOT adjust the relative Cell Formula References so the correct
value is calculated for that row.
QUESTIONS
1) What am I doing wrong?
===================
What's the best way to handle Formulas when creating a new Workbook from
VB:
1) Same as above using Formula Property
2) Putting Formula into an Existing Excel Workbook/Sheet and copying the
formula from one Excel Workbook to another
3) Create a separate sheet, Insert formulas into that sheet and then copy
to sheet of interest.
4) Other
Thanks