jhtromb Posted March 19, 2012 Share Posted March 19, 2012 Hello, I need to read some lines from an excel file that works with filter and write the values into an array. My problem is: if I use the Excel UDF the script reads every line (there are more than 3.000), but I only need the filtered lines (around 150). Is it possible to take the filtered lines into consideration only? Thank you in advance! Link to comment Share on other sites More sharing options...
water Posted March 19, 2012 Share Posted March 19, 2012 Loop through the cells and check the hidden attribute as described here.Or use method intersect to get the visible rows as described here. 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...
Juvigy Posted March 20, 2012 Share Posted March 20, 2012 or something like that; $oExcel = _ExcelBookAttach("Startup.xlsb", "FileName") $rng = $oExcel.Application.Activesheet.Autofilter.Range.Columns(2) $rng = $rng.Offset(1,0).Resize($rng.rows.count -1,1) $rng1 = $rng.SpecialCells(12) $i=0 Dim $Array[$rng.SpecialCells(12).count] For $element in $rng1 $Array[$i] = $element.value $i=$i+1 Next _ArrayDisplay($Array) Link to comment Share on other sites More sharing options...
jhtromb Posted March 20, 2012 Author Share Posted March 20, 2012 Thank you for your suggestions! I solved it in another way by just selecting all cells and copying them to a new sheet. This only copies the filtered values. 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