Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Export a formula to excel - is it possible?

Hi,

Is it possible to export (via VBS) a formula to excel? We export now row by row (A, B, C) the cell values via a macro, and in a certain row (e.g. D) we want to export a formula (e.g. =Ci/Bi*F1), so that it is preprogrammed for the end user who can type a different value in the cell F1 and see the changed result in column D.

What is the VBS function for formula export if it is possible?

Thanks,

B.

3 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

That should be possible.

set xl = createobject("excel.application")

set wb = xl.workbooks.add

set ws = wb.worksheets(1)

xl.visible = true

ws.range("D1:D100").formula = "C1/B1*F$1"

this should result in D2 having the formula C2/B2*F$1 and not C1/B1*F$1


talk is cheap, supply exceeds demand
Not applicable
Author

Thank you, I'll test it.

Clever_Anjos
Employee
Employee

You can create a column at your table that contains your formula

='=C'&rowno()&'B'&rowno()&'*F$1'

When this table is copied to excel, the formula will be translated.

Important: When you export, this trick does not work, only when you copy/paste