WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: int5749 on April 10, 2017, 07:43:21 AM

Title: Excel: Cell Information for Formula
Post by: int5749 on April 10, 2017, 07:43:21 AM
Hi all,

I created a Winbatch Script which fills data into an Excel => So far so good and working fine

I'm doing this while counting row/column.

Now I have to put a formula into cells of a specific column but "cells(1, 1)" doesn't work while "A1" is expected.
e.g. I have to fill in a formula "=COUNTIF(E2:N2;"X")" after I added 10 Columns after starting on column 5 (aka => E)

Any idea hwo I can manage this??

Regards and thanks,
joerg
Title: Re: Excel: Cell Information for Formula
Post by: td on April 10, 2017, 10:39:34 AM
Perhaps start with the Tech Database.  Here is link to but one of many Excel examples there:

http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/OLE~COM~ADO~CDO~ADSI~LDAP/OLE~with~Excel/Samples~from~Users+Auto~Sum~Two~Columns~In~Excel.txt (http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/OLE~COM~ADO~CDO~ADSI~LDAP/OLE~with~Excel/Samples~from~Users+Auto~Sum~Two~Columns~In~Excel.txt)
Title: Re: Excel: Cell Information for Formula
Post by: td on April 10, 2017, 11:16:19 AM
Here is the reference for the FormulaR1C1 property:

https://msdn.microsoft.com/en-us/library/office/ff823188.aspx?f=255&MSPPError=-2147217396 (https://msdn.microsoft.com/en-us/library/office/ff823188.aspx?f=255&MSPPError=-2147217396)

Here is the reference for the Forumla property:

https://msdn.microsoft.com/en-us/library/office/ff838835.aspx (https://msdn.microsoft.com/en-us/library/office/ff838835.aspx)
Title: Re: Excel: Cell Information for Formula
Post by: stanl on April 11, 2017, 03:55:27 AM
Not to intercede, but are you trying to include the Countif() formula in your code, or populate cells in a template where the formula is expected to execute.  If the former, look into .FormulaR1C1 .