HighlanderSword Posted December 27, 2011 Share Posted December 27, 2011 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 Link to comment Share on other sites More sharing options...
HighlanderSword Posted December 27, 2011 Author Share Posted December 27, 2011 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)" Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now