Solved

VBA Filter

Posted on 2013-01-24
3
283 Views
Last Modified: 2013-01-24
Hi,

Im looking for code to filter for "XYZ in column A

If there is no "XYZ" then i need the code to just ignore and move on, not to bomb out!

Has anyone such code?

Thanks!
0
Comment
Question by:Seamus2626
  • 2
3 Comments
 
LVL 26

Accepted Solution

by:
redmondb earned 500 total points
ID: 38813935
Hi, Seamus2626,

I'm not sure I understand your requirements properly as filtering on a non-existent value doesn't cause an error...
Option Explicit

Sub Column_A()

If Not ActiveSheet.AutoFilterMode Then ActiveSheet.UsedRange.AutoFilter
If ActiveSheet.FilterMode Then ActiveSheet.ShowAllData
ActiveSheet.Range("A:A").AutoFilter Field:=1, Criteria1:="=xyz", Operator:=xlAnd

End Sub

Open in new window

Regardsm
Brian.
0
 

Author Closing Comment

by:Seamus2626
ID: 38813947
All good Brian!
0
 
LVL 26

Expert Comment

by:redmondb
ID: 38813954
Short and sweet - thanks, Seamus2626!
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Hiding information in Excel 16 70
If a cell in a range equals "YES" return specific Test. 4 30
Excel Cell Total 3 20
vba autofilter in row 4 6 9
Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvie…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

776 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