Jump to content
Sign in to follow this  
jhtromb

Excel AutoFilter - Only filtered values

Recommended Posts

jhtromb

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!

Share this post


Link to post
Share on other sites
water

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 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
Juvigy

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)

Share this post


Link to post
Share on other sites
jhtromb

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.

Share this post


Link to post
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
Sign in to follow this  

×