Sign in to follow this  
Followers 0
KenNichols

There must be a better way

3 posts in this topic

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!

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 by MrMitchell

Share this post


Link to post
Share on other sites

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!

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