0
votes

I have a database query the results that are saved to an Excel file. Once there, I need to add a column and insert formula to do make it an interactive worksheet.

Is there a way of having the formula created in the data base output? Note that I do not want the results entered. I want the Excel formula to be in the cell. Example in one cell I enter =IFERROR(TODAY()-I14+1,0) the results in the Excel spreadsheet change base on the date the information is viewed.

1

1 Answers

0
votes

use the cell formula property to dynamically add formula:

Range("A1").Formula = "=text(now(),""mmm dd yyyy"")" 

ref: https://msdn.microsoft.com/en-us/library/office/ff838835.aspx