Jump to content

[SOLVED] Is it possible to skip a blank cell with my code?


Recommended Posts

I was wondering if it is possible to make this code skip to the next row if it reads a blank line?

I tried this.

If $aArray = "" Then
       $r += 1
    EndIf
#include <Excel.au3>


Local $r = 1
    Local $aArray = _Excel_RangeRead($oWorkbook)
    ;~ If $iBox is greater than no. of rows in $aArray then $iBox equals the number of rows in $aArray
    If $iBox > (UBound($aArray) - 1) Then $iBox = UBound($aArray) - 1
    For $i = 1 To UBound($aArray) - 1   ;$i =0 Start from row A
    If $aArray = "" Then
        $r += 1
    EndIf
     
        $sR0  = $aArray[$i][0]    ;status
        $sR1  = $aArray[$i][1]    ;first name
        $sR2  = $aArray[$i][2]    ;Last name
        $sR3  = $aArray[$i][3]    ;Last 4 SSN
        $sR4  = $aArray[$i][4]    ;DOB
        $sR5  = $aArray[$i][5]    ;Email Address
        $sR6  = $aArray[$i][6]    ;Mailling Address
        $sR7  = $aArray[$i][7]    ;City
        $sR8  = $aArray[$i][8]    ;state
        $sR9  = $aArray[$i][9]    ;Zip Code
        $sR10 = $aArray[$i][10]   ;Gender
        $sR11 = $aArray[$i][11]   ;Phone

   WinSetState ("ADM.MCK - Registration Management Desktop","",@SW_MAXIMIZE)


      WinWaitActive("[CLASS:Notepad]", "", 10)

       ControlSend("[CLASS:Notepad]", "", "", ("{F8}"))
            Sleep (500)
        ControlSend("[CLASS:Notepad]", "", "", ("{F8}"))
            Sleep (500)
        ControlSend("[CLASS:Notepad]", "", "", ("N"))
        ControlSend("[CLASS:Notepad]", "", "", ("{TAB}"))
            Sleep (3000)
        ControlSend("[CLASS:Notepad]", "", "Edit1", $sR1 & @CR)
            Sleep (200)
        ControlSend("[CLASS:Notepad]", "", "", ("{TAB}"))
            Sleep (200)
        ControlSend("[CLASS:Notepad]", "", "Edit1", $sR2 & @CR)
            Sleep (200)
        ControlSend("[CLASS:Notepad]", "", "", ("{TAB}"))
            Sleep (200)
        ControlSend("[CLASS:Notepad]", "", "Edit1", $sR6& @CR)
            Sleep (200)
        ControlSend("[CLASS:Notepad]", "", "", ("{TAB}"))
            Sleep (200)
        ControlSend("[CLASS:Notepad]", "", "Edit1", $sR7 & @CR)
            Sleep (200)
        ControlSend("[CLASS:Notepad]", "", "Edit1", $sR8 & @CR)
            Sleep (200)
        ControlSend("[CLASS:Notepad]", "", "Edit1", $sR9 & @CR)
            Sleep (200)
        ControlSend("[CLASS:Notepad]", "", "Edit1", $sR11& @CR)
            Sleep (200)
        ControlSend("[CLASS:Notepad]", "", "Edit1", $sR5 & @CR) ;Email
            Sleep (200)
        ControlSend("[CLASS:Notepad]", "", "Edit1", $sR5 & @CR)  ;Email
            Sleep (200)
        ControlSend("[CLASS:Notepad]", "", "", (FormatDate($sR4) & @CR))


      $r += 1

 

 

Edited by SkysLastChance

You miss 100% of the shots you don't take. -Wayne Gretzky -Michael Scott

Link to comment
Share on other sites

Func Auto ()
    Local $r = 1
    Local $aArray = _Excel_RangeRead($oWorkbook)
    ;~ If $iBox is greater than no. of rows in $aArray then $iBox equals the number of rows in $aArray
    If $iBox > (UBound($aArray) - 1) Then $iBox = UBound($aArray) - 1
    For $i = 1 To UBound($aArray) - 1   ;$i =0 Start from row A
    If $aArray[$i][1] = "" Then Continueloop

        $sR0  = $aArray[$i][0]    ;status
        $sR1  = $aArray[$i][1]    ;first name
        $sR2  = $aArray[$i][2]    ;Last name
        $sR3  = $aArray[$i][3]    ;Last 4 SSN
        $sR4  = $aArray[$i][4]    ;DOB
        $sR5  = $aArray[$i][5]    ;Email Address
        $sR6  = $aArray[$i][6]    ;Mailling Address
        $sR7  = $aArray[$i][7]    ;City
        $sR8  = $aArray[$i][8]    ;state
        $sR9  = $aArray[$i][9]    ;Zip Code
        $sR10 = $aArray[$i][10]   ;Gender
        $sR11 = $aArray[$i][11]   ;Phone

This worked for me thank you!

You miss 100% of the shots you don't take. -Wayne Gretzky -Michael Scott

Link to comment
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
 Share

×
×
  • Create New...