|
-
Dec 28th, 2006, 10:06 PM
#1
Thread Starter
Lively Member
[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
-
Dec 28th, 2006, 10:22 PM
#2
Hyperactive Member
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?
Rate Me! Rate Me! Rate Me!
Time to fly.
Copyright GraysonSoft Inc. 2007
-
Dec 28th, 2006, 10:27 PM
#3
Hyperactive Member
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.
Rate Me! Rate Me! Rate Me!
Time to fly.
Copyright GraysonSoft Inc. 2007
-
Dec 28th, 2006, 10:30 PM
#4
Thread Starter
Lively Member
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
-
Dec 28th, 2006, 10:33 PM
#5
Hyperactive Member
Re: How to use Excel.Range.AutoFilter method
Ah ok. Have you tried my suggestion?
Rate Me! Rate Me! Rate Me!
Time to fly.
Copyright GraysonSoft Inc. 2007
-
Dec 28th, 2006, 11:11 PM
#6
Thread Starter
Lively Member
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 =)
-
Dec 28th, 2006, 11:19 PM
#7
-
Dec 29th, 2006, 01:29 AM
#8
Thread Starter
Lively Member
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..
-
Dec 29th, 2006, 01:43 AM
#9
Hyperactive Member
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.
Rate Me! Rate Me! Rate Me!
Time to fly.
Copyright GraysonSoft Inc. 2007
-
Dec 29th, 2006, 02:25 AM
#10
Thread Starter
Lively Member
Re: How to use Excel.Range.AutoFilter method
thanks tommy! how will I mark this thread as resolved?
-
Dec 29th, 2006, 04:44 AM
#11
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.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Dec 29th, 2006, 05:14 AM
#12
Thread Starter
Lively Member
Re: How to use Excel.Range.AutoFilter method
thanks Master. where is the Thread Tools menu? is it in the C# page?.. thanks
-
Dec 29th, 2006, 06:55 AM
#13
Re: How to use Excel.Range.AutoFilter method
 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.
-
Jan 3rd, 2007, 04:56 AM
#14
Thread Starter
Lively Member
Re: [RESOLVED] How to use Excel.Range.AutoFilter method
thanks Hack!! I got it =)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|