Jump to content

Recommended Posts

Posted

Stuck here scratching my head again.

I am trying to write a formula    =IF(AND(X2="X",Y2=""),1,"")   to the B2 cell in excel. 

However, my code does not put anything in.  I also don't get any errors. 

#include <Excel.au3>

Local $oWorkbook

$oExcel = _Excel_Open()

$sWorkbook = @ScriptDir & "\VitalSite" & " " & @Mon & "_" & @MDAY & "_"  & @Year & ".xlsx"

$oWorkbook = _Excel_BookOpen($oExcel,$sWorkbook)

_Excel_RangeWrite($oWorkbook,Default, '=IF(AND(X' & 2 & '="X",Y' & 2 & '=""),1,"Hello"', "B" & 2)

 

 

You miss 100% of the shots you don't take. -Wayne Gretzky -Michael Scott

Posted

over complicated, try :

_Excel_RangeWrite($oWorkbook,Default, '=IF(AND(X2="X",Y2=""),1,"Hello")', "B2")

FYI formula may differ depending on Office language. Mine is french, so formulas use french word and different delimiter...

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
×
×
  • Create New...