Rambert Posted May 26, 2016 Share Posted May 26, 2016 Hi everybody. I am using function _Excel_RangeFind to look a value at excel file. That file only has one sheet. There are about 4000 rows and 5 columns. I need to look for a value in that range A1:A4000 and get the rest of values of that row. So i am able to find a value that exists at excel file, but if i look for a value that is not in file how can i manage that error. Resuming if i look for a value in cells range A1:A4000 and it's found, I am able to take the rest of values ( imagine value is found in A130 cell then i can get an array with values in cells A130 B130 C130 D130 E130) but if value is not found in any cell i need show a msgbox and exit program. My problem is when value is not found. I can't manage error. Thanks and regards. Link to comment Share on other sites More sharing options...
AutoBert Posted May 26, 2016 Share Posted May 26, 2016 Test one of the examples in helpfile and you see how to do this. Link to comment Share on other sites More sharing options...
Rambert Posted May 26, 2016 Author Share Posted May 26, 2016 I have read four scripts at help but i must be blind cause I can't get it I will try to read again and if i don't get it, i will post here thanks Link to comment Share on other sites More sharing options...
Rambert Posted May 26, 2016 Author Share Posted May 26, 2016 (edited) Nothing... I have created a test scripts like help scripts number 1 I have changed only string to find ( 37000 to 99999) I have created a folder named Extras at my folder scripts, and i have copied _Excel1.xls on it. I have pressed F5 and tell me data has been searched... but show me an empty array Could you test it??? thanks and regards Edited May 26, 2016 by Rambert Link to comment Share on other sites More sharing options...
Rambert Posted May 26, 2016 Author Share Posted May 26, 2016 (edited) One advise I have modified function file as i have read here at forum cause i have autoit 3.3.14.0 https://www.autoitscript.com/forum/topic/182286-_excel_rangefind/?do=findComment&comment=1309096 Edited May 26, 2016 by Rambert Link to comment Share on other sites More sharing options...
AutoBert Posted May 26, 2016 Share Posted May 26, 2016 Can't you see all examples using: Local $aResult = _Excel_RangeFind($oWorkbook, "* Story", Default, Default, $xlWhole) If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeFind Example 4", "Error searching the range." & @CRLF & "@error = " & @error & ", @extended = " & @extended) same as you want: Showing MsgBox and Exit. Link to comment Share on other sites More sharing options...
Rambert Posted May 26, 2016 Author Share Posted May 26, 2016 Tested at this moment Look my files attached Link to comment Share on other sites More sharing options...
Rambert Posted May 26, 2016 Author Share Posted May 26, 2016 i go bed thanks and regards Link to comment Share on other sites More sharing options...
water Posted May 27, 2016 Share Posted May 27, 2016 Not finding a specified string is not regarded to be an error by the function. It always returns the number of found cells in the array. When there are no cells matching the search string then an empty array is being returned. So check the number of Rows in the array. 0 means: Nothing found. 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...
Rambert Posted May 27, 2016 Author Share Posted May 27, 2016 How can i chek number of rows??? Link to comment Share on other sites More sharing options...
water Posted May 27, 2016 Share Posted May 27, 2016 If UBound($aResult, 1) > 0 Then ... ; Find successful 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...
Rambert Posted May 29, 2016 Author Share Posted May 29, 2016 Thanks. I will check later 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