Jump to content
gogrant43

_Excel_RangeReplace change ints not strings

Recommended Posts

gogrant43

I am writing an AutoIT script that searches for values that are less than 5 from the range E2:E1000 (these values could only possibly be 1, 2, 3, or 4 in my case) and changes these values to 0. Using _Excel_RangeReplace, I am able to do this, but I have a problem. The problem is that any values above 5 that have a 1 in it (for example, 111 or 4912) are also changed to 0. How can I make it so that only the values 1, 2, 3, or 4 are changed to 0?

_Excel_RangeReplace($oWorkbook, Default, "E2:E1000", int(1), 0)
_Excel_RangeReplace($oWorkbook, Default, "E2:E1000", int(2), 0)
_Excel_RangeReplace($oWorkbook, Default, "E2:E1000", int(3), 0)
_Excel_RangeReplace($oWorkbook, Default, "E2:E1000", int(4), 0)

This is the code I have so far for this.

Share this post


Link to post
Share on other sites
Subz

Change the parameter for $xlpart to $xlwhole.

_Excel_RangeReplace($oWorkbook, Default, "E2:E1000", int(1), 0, $xlwhole)

 

Edited by Subz
Example added

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

×