+ Reply to Thread
Results 1 to 5 of 5

how to exclude a criteria using auto filter

  1. #1
    Registered User
    Join Date
    03-21-2013
    Location
    hyderabad
    MS-Off Ver
    Excel 2010
    Posts
    6

    Lightbulb how to exclude a criteria using auto filter

    In my spreadsheet the column "C" can contains all values of 0,1,2,........10.

    What exactly i need is, if the column "C" contains any value other than 0, in need a msg box that "values greater the 0 found"

    i tried using below code
    if activesheet.range("C:C").autofilter:=3,criteria:=">0",then
    msgbox"values greater the 0 found"


    But i find this not working.Can someone help on the above

  2. #2
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: how to exclude a criteria using auto filter

    It is not clear to me what you really want.
    Can data in column C be from 0 to 10?
    Why do you want a message box telling a number other than 0 was found?
    Can you explain a little more?
    Pierre Leclerc
    _______________________________________________________

    If you like the help you got,
    Click on the STAR "Add reputation" icon at the bottom.

  3. #3
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: how to exclude a criteria using auto filter

    If you use autofilter (>3), all you'll see is the rows with >3 in Column C.
    You should not need a message box as all of them will be >3.
    I assume that that is what you have in mind as you mentioned autofilter.
    Adjust the code below.

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    12-05-2012
    Location
    Crewe, Cheshire, UK
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: how to exclude a criteria using auto filter

    try this?
    it firstly checks if there is anything in C:C, then uses a worksheet function to count values that are greater than 0

    Please Login or Register  to view this content.
    if you change it to this, it will count values that are not equal to 0 (either greater or smaller)

    Please Login or Register  to view this content.

  5. #5
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: how to exclude a criteria using auto filter

    Hi kadasanis

    Don't know why you're doing what you're doing but this does it
    Please Login or Register  to view this content.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1