xcaliber13 Posted May 20, 2016 Share Posted May 20, 2016 So I am rewriting most of my vbs scripts to AutoIt. I am having a little trouble with this one. Here is what works in vbs: For i = 2000 To 1 Step -1 If objExcel.Range("C" & i).Value = objExcel.Range("N" & i).Value Then objExcel.Rows(i).DeleteNext Compares one cell to another and if = delete that row. Here is what I have in AutoIt but it does not work. For $i = 2000 To 1 Step -1 If $oWorkbook.ActiveSheet.Range("C" & $i).Value = $oWorkbook.ActiveSheet.Range("N" & $i).Value Then $oWorkbook.ActiveSheet.Rows($i).Delete Next AutoIt script completes with no errors but no rows are deleted. What am I missing? Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 20, 2016 Moderators Share Posted May 20, 2016 @xcaliber13 this is working for me: #include <Excel.au3> Local $oExcel = _Excel_Open() Local $oWorkbook = _Excel_BookOpen($oExcel, @DesktopDir & "\Test.xlsx") For $i = 50 To 1 Step -1 If _Excel_RangeRead($oWorkbook, Default, "C" & $i) = _Excel_RangeRead($oWorkbook, Default, "N" & $i) Then $oExcel.Rows($i).Delete EndIf Next "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
xcaliber13 Posted May 20, 2016 Author Share Posted May 20, 2016 Hey jLogan3o13 Thank you for the quick reply. Works like a charm. Thank you 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