Sign in to follow this  
Followers 0
xcaliber13

Excel vbs to Autoit Help

3 posts in this topic

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 = 2000To1Step -1
     If objExcel.Range("C" & i).Value = objExcel.Range("N" & i).ValueThen objExcel.Rows(i).Delete
Next    

 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?

Share this post


Link to post
Share on other sites



@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

 


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Hey jLogan3o13

               Thank you for the quick reply. Works like a charm.

Thank you

 

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