13lack13lade Posted August 5, 2013 Share Posted August 5, 2013 (edited) Hi Guys! I am using autoit with excel and want to skip blank rows in my excel read cell otherwise run the loop, i also want to run the loop upto a max 10000 lines. The way i am thinking of doing it is: If $TypCellValue = " " THEN skip row ELSE do my send commands. but how do i tell autoit to skip or move to next row in excel? Would it be something like this? If $TypCellValue = "" then $i = 1 (+1) to 10000 ? or something like that For $i = 1 To 10000 ;Loop $TypCellValue = _ExcelReadCell($oExcel, $i, 1) $CityCellValue = _ExcelReadCell($oExcel, $i, 2) $PrdCellValue = _ExcelReadCell($oExcel, $i, 3) Sleep(1000) WinActivate("program") Send("C") Sleep(500) Send("{TAB}") Sleep(500) Send($TypCellValue) Sleep(700) Send($CityCellValue) Sleep(700) Send($PrdCellValue) Sleep(1000) Send("{ENTER}") Sleep(700) Edited August 6, 2013 by 13lack13lade Link to comment Share on other sites More sharing options...
GMK Posted August 6, 2013 Share Posted August 6, 2013 (edited) I would think it would be easier to just run your loop and only perform actions if the cell is not blank. For $i = 1 To 10000 ;Loop $TypCellValue = _ExcelReadCell($oExcel, $i, 1) $CityCellValue = _ExcelReadCell($oExcel, $i, 2) $PrdCellValue = _ExcelReadCell($oExcel, $i, 3) If $TypCellValue <> "" Then Sleep(1000) WinActivate("program") Send("C") Sleep(500) Send("{TAB}") Sleep(500) Send($TypCellValue) Sleep(700) Send($CityCellValue) Sleep(700) Send($PrdCellValue) Sleep(1000) Send("{ENTER}") Sleep(700) EndIf Next Edited August 6, 2013 by GMK Link to comment Share on other sites More sharing options...
13lack13lade Posted August 6, 2013 Author Share Posted August 6, 2013 (edited) Thanks for your reply GMK however doesnt appear to like that at all, im not sure if its because of the other loop i have after it but it still does the same thing seems like its missing the loop completely because some of the rows contain data and therefore skips straight to the second loop sending DN... i just need it to skip down 1 row untill $typecellvalue contains anything. expandcollapse popupFor $i = 1 To 10000 ;Loop $TypCellValue = _ExcelReadCell($oExcel, $i, 1) $CityCellValue = _ExcelReadCell($oExcel, $i, 2) $PrdCellValue = _ExcelReadCell($oExcel, $i, 3) sleep (2000) winactivate("Calypso Host - Test1") sleep (700) If $TypCellValue <> "" Then Send("C") Sleep(500) Send("{TAB}") Sleep(500) Send($TypCellValue) Sleep(700) Send($CityCellValue) Sleep(700) Send($PrdCellValue) Sleep(1000) Send("{ENTER}") Sleep(700) EndIf If $TypCellValue = "H" Then Send("{TAB 4}") Else Send("{TAB 6}") EndIf Sleep(700) send("DN") Sleep(700) send("{ENTER}") Sleep(700) send("{LSHIFT}+{DEL}") Sleep(700) send("{ENTER}") sleep(700) send("{LSHIFT}+{DEL}") Sleep(700) send("{ENTER}") Sleep(700) send("{LSHIFT}+{DEL}") Sleep(700) send("{ENTER}") sleep(700) Edited August 6, 2013 by 13lack13lade Link to comment Share on other sites More sharing options...
Solution 13lack13lade Posted August 6, 2013 Author Solution Share Posted August 6, 2013 DW - made some VBA code to sort out this issue.. Link to comment Share on other sites More sharing options...
GMK Posted August 6, 2013 Share Posted August 6, 2013 Glad to hear you solved your problem. Link to comment Share on other sites More sharing options...
water Posted August 6, 2013 Share Posted August 6, 2013 It is a good idea to NOT mix access to Excel (Word, Outlook etc.) via COM and the GUI. That's a nightmare to debug. Everything (most) you can do via the GUI can be done using COM. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki 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