Solved

VBA filters

Posted on 2016-10-16
2
50 Views
Last Modified: 2016-10-17
Hi Experts,

As we know that we have filters in excel as shown below:

filters
How can I achieve this in VBA coding e.g. at the click of the button, I have 10 columns in my sheet.

Thanks
meetDinesh
0
Comment
Question by:Dinesh Kumar
2 Comments
 
LVL 15

Accepted Solution

by:
Haris Djulic earned 500 total points
ID: 41846137
From:
https://msdn.microsoft.com/en-us/library/office/ff193884.aspx

Here is code sniplet adjust it according to your need.
Worksheets("Sheet1").Range("A1").AutoFilter _
 field:=1, _
 Criteria1:="Otis", _
 VisibleDropDown:=False
0
 

Author Closing Comment

by:Dinesh Kumar
ID: 41846278
Thanks Harish.

Worksheets("Results").Range("A4:B4").AutoFilter

worked.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now