Clerythecleric

After setting a filter in excel, How to copy the results to new sheet?

2 posts in this topic

#1 ·  Posted (edited)

First time using the excel UDF, I have managed to write a simple script that just simply applys 2 filters and then sorts them in order. I need to copy the results after the filter is set to a new sheet. I did manage to pull somthing together but that copied the entire document over and i just need the ones applied after the filter. Or alternatively just delete all the rows that are not picked up in the filter.

 

I tried messing with " _Excel_RangeCopyPaste " and _Excel_RangeDelete  but i just can't seem to get the hang of it. IF anyone could be kind enough to push me in the right direction I would really appreciate it!

 

Thanks

 

This is what i have so far, i know its basic but it does exactly what i needed it to.

#include <Excel.au3>
#include <Array.au3>

HotKeySet("{ESC}", "On_Exit")
HotKeySet("{F1}", "FilterSheet")
HotKeySet("{F2}", "test")

global $workbook = _Excel_BookAttach("Book1")
if @error Then
   MsgBox("", "Error", "Could not attach")
Else
   MsgBox("", "Attached", "Attached Successfully")
EndIf

while 1
   Sleep(50)
WEnd

func FilterSheet()
_Excel_FilterSet($workbook, Default, Default, 12, "<0")
_Excel_FilterSet($workbook, Default, Default, 4, ">1")
_Excel_RangeSort($workbook, Default, Default, "L:L", Default, Default, $xlYes)
EndFunc
    

func test()
$aResult = _Excel_RangeFind($workbook, "<1")

EndFunc

func On_Exit()
Exit
EndFunc

 

 

Edited by Clerythecleric

Share this post


Link to post
Share on other sites



#2 ·  Posted

An example can be found in the wiki.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

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