NOTE: Microsoft DOES NOT officially support office automation (i.e. what we're doing above and what FDM does behind the scenes I would suspect) Seems to work just fine though in most instances, etc. Be careful on clean-up to make sure all memory is freed and that the excel instance terminates.
on error resume next 'make sure all commands are executed. If something happens in code and file is open, we don't want to leave it open... Set objExcel = CreateObject("Excel.Application") Set objWorkbook = objExcel.Workbooks.Open("<put reference to your file here>") Set objworkSheet = objWorkbook.Sheets("<Name of worksheet here>") 'OR you could use ordinal objExcel.Application.DisplayAlerts = False objExcel.Application.Visible = false for x = 1 to 100 'I'm just doing a loop for the sake of doing a loop. You might want to loop through rows and for each row that has a 'value in col A, make the formula and then break out of loop so you don't add a metric ton of unnecessary formulas objworksheet.Cells(x, "C").Formula = "=A" & x & " + B" & x 'i.e. =A1+B1 next 'Save the changes objWorkbook.Save 'Close the workbook objWorkbook.Close 'Quit application (important) objworksheet = nothing objworkbook = nothing objExcel.Application.Quit objexcel = nothing