[RESOLVED] How to use Excel.Range.AutoFilter method
Hi C# Guys,
I'm new in using Excel automation (Excel Primary Interop), I need to know how to use Excel.Range.AutoFilter method correctly.. Do you have any idea how can I use this properly in my program??? Thank you guys.. Happy New Year to all of you..
Happy Programming,
den
Re: How to use Excel.Range.AutoFilter method
Welcome to VBForums.
Just want to ask what do you want to do with Excel.Range.Autofilter?
Re: How to use Excel.Range.AutoFilter method
Try this:
VB Code:
Excel.Range("A1:Z23").Autofilter
This is what the macro recorded when I used the Autofilter.
Re: How to use Excel.Range.AutoFilter method
Through Excel.Range.AutoFilter method, I think I can filter all the records in the cell by ascending, descending, top 10 items.. the usual filter items of AutoFilter method.. thanks
Re: How to use Excel.Range.AutoFilter method
Ah ok. Have you tried my suggestion?
Re: How to use Excel.Range.AutoFilter method
I tried it however the code didn't make sense in c# code =) syntax may differ.. What I want to be outputed in my excel automation is, once the excel is generated, the columns will have a dropdown list containing choices like: ascending, descending, top10Items, etc.. and once I choosed an item among the choices, the records in the cells will respond accordingly =)
Re: How to use Excel.Range.AutoFilter method
Post us the code so that we may know the proper syntax.
:lol: :lol: :lol:
Re: How to use Excel.Range.AutoFilter method
Thanks tommygrayson i solved my problem!!! =) here is my code to share to all of you:
"c#"
range = workSheet.get_Range("A2", m_objOpt);
range.AutoFilte(1, "<0",Excel.XlAutoFilterOperator.xlOr, "<100",Type.Missing);
you should load first the item from the database or any data sources in cells before invoking this code. =)
regards to you..
Re: How to use Excel.Range.AutoFilter method
Ok. Just remember to mark this thread as resolved so that others will know that your problem has been resolved.
Also don't forget to go to VBForums in case you need help.
Re: How to use Excel.Range.AutoFilter method
thanks tommy! how will I mark this thread as resolved?
Re: How to use Excel.Range.AutoFilter method
Use the Thread Tools menu > Mark thread as Resolved. ;)
I have some C# Excel code examples in my Office FAQ too just in case. :)
Re: How to use Excel.Range.AutoFilter method
thanks Master. where is the Thread Tools menu? is it in the C# page?.. thanks
Re: How to use Excel.Range.AutoFilter method
Quote:
Originally Posted by denvercr
thanks Master. where is the Thread Tools menu? is it in the C# page?.. thanks
Scroll up to the first post in this thread. Above it you will see a menu item called "Thread Tools". Click on it, and the menu item for resolving a thread will be there. :)
Re: [RESOLVED] How to use Excel.Range.AutoFilter method
thanks Hack!! I got it =)