Sign in to follow this  
Followers 0
HighlanderSword

Excel.Au3 Write Formula question

2 posts in this topic

Hello,

When using the code below to write the formula into the cell it does work and create the formula in the cell, however it

is adding in the $ to the cell references so that when the data is sorted the formulas do not reference the correct cells.

How do I force the writeformula to not put in The $ Cell references ?

Thanks

Paul

The actual formulat that gets written intoi the cell a2 is

=IF(ISNA(VLOOKUP($A$2,Scheduled_Reports!$C:$C,1,FALSE)),"NO","YES")

#include <IE.au3>

#include <file.au3>

#include <Date.au3>

#include <Array.au3>

#include <Excel.au3>

$oExcel_to=_ExcelBookOpen("C:\fixme2.xlsx")

_ExcelSheetActivate($oExcel_to, "Email_locations")

$oExcel_to.ActiveSheet.Columns("A:D").AutoFilter

$r=2

Do

$stryn='"' & "NO" & '"' & "," & '"' & "YES" & '"'

;~ MsgBox(4096,"y/n",$stryn)

$Strformula = "=if(isna(VLOOKUP(A" & $r & ",Scheduled_Reports!c3:C3,1,FALSE))," & $stryn & ")"

;~ MsgBox(4096,"formula",$Strformula)

_ExcelWriteFormula($oExcel_to, $Strformula, $r, 4)

$r=$r+1

Until StringLen(_ExcelReadCell($oExcel_to, $r, 3))=0

Share this post


Link to post
Share on other sites



Hello,

I resolved my issue using the Snippet Below

$oExcel_to.range("E" & $r).select

$oExcel_to.ActiveCell.FormulaR1C1 = "=VLOOKUP(Rc[-2],Email_Locations!R1C1:R3000C3,2,FALSE)"

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0