jhtromb Posted March 19, 2012 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!
water Posted March 19, 2012 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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Juvigy Posted March 20, 2012 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)
jhtromb Posted March 20, 2012 Author 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.
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