KenNichols Posted June 8, 2011 Share Posted June 8, 2011 I know there must be a better way than to add all of the "Or" #include <excel.au3> $ExcelWinList = WinList ("Microsoft Excel") $Title = StringReplace ($ExcelWinList [1] [0], "Microsoft Excel - ", "") $oExcel = _ExcelBookAttach ("Microsoft Excel - " & $Title, "Title") $ActiveCell = $oExcel.Application.ActiveCell.Address If $ActiveCell = "$A$23" Or $ActiveCell = "$A$39" Or $ActiveCell = "$A$59" Or $ActiveCell = "$A$75" Or $ActiveCell = "$A$91" Or $ActiveCell = "$A$112" Or $ActiveCell = "$A$128" Or $ActiveCell = "$A$144" Or $ActiveCell = "$A$160" Or $ActiveCell = "$A$176" Or $ActiveCell = "$A$192" Then MsgBox(0, "Success", "Active Cell = " & $ActiveCell,2) EndIf [topic="21048"]New to AutoIt? Check out AutoIt 1-2-3![/topic] Need to make a GUI? You NEED KODA FormDesigner! Link to comment Share on other sites More sharing options...
MrMitchell Posted June 8, 2011 Share Posted June 8, 2011 (edited) You could use a StringRegExp()Similar question I'll post an example in a few...Add:Something like...If StringRegExp($ActiveCell, "(?i)\$A\$(23|39|59|75|91|112|128|144|160|176|192)") Then MsgBox(0, "Success", "Active Cell = " & $ActiveCell,2) EndIf Edited June 8, 2011 by MrMitchell Link to comment Share on other sites More sharing options...
KenNichols Posted June 8, 2011 Author Share Posted June 8, 2011 You could use a StringRegExp() Similar question I'll post an example in a few... Add: Something like... If StringRegExp($ActiveCell, "(?i)\$A\$(23|39|59|75|91|112|128|144|160|176|192)") Then MsgBox(0, "Success", "Active Cell = " & $ActiveCell,2) EndIf Thanks! That is slick! [topic="21048"]New to AutoIt? Check out AutoIt 1-2-3![/topic] Need to make a GUI? You NEED KODA FormDesigner! 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