+ Reply to Thread
Results 1 to 5 of 5

Check If Filtering Worksheet Removes All Rows

  1. #1
    Forum Contributor
    Join Date
    06-18-2010
    Location
    USA
    MS-Off Ver
    Excel 2016
    Posts
    546

    Check If Filtering Worksheet Removes All Rows

    I have a worksheet that is being filtered based of selected criteria and certain columns are being copied to a new worksheet and a few calculations being performed. The issue I am running into is that when the filter criteria yields 0 results I get a division by 0 error.

    How can I get a count of the rows being displayed after filter condition applied, and conditionally carry on based off the filtered number of rows?

    EDIT -> And if it makes a difference this is for an access query that was imported from access in Excel
    Last edited by jo15765; 03-27-2017 at 08:45 AM.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Check If Filtering Worksheet Removes All Rows

    If you're using Autofilter as the filter method, then try something like this...

    Please Login or Register  to view this content.
    Otherwise, you'll have to elaborate on the nature of your data and the filtering method used. Perhaps if you attached an an example workbook, that would would help explain.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Forum Contributor
    Join Date
    06-18-2010
    Location
    USA
    MS-Off Ver
    Excel 2016
    Posts
    546

    Re: Check If Filtering Worksheet Removes All Rows

    @AlphaFrog - this gives me an error of object variable or with block variable not set. This is more syntax and how I plan to use it
    Please Login or Register  to view this content.

  4. #4
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Check If Filtering Worksheet Removes All Rows

    Hi,

    For a Table you might make a small change
    Please Login or Register  to view this content.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  5. #5
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Check If Filtering Worksheet Removes All Rows

    Or test before you autofilter.

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Macro that removes blank rows?
    By taylorsm in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 02-22-2017, 09:35 PM
  2. Macro that removes empty rows within a table
    By airedale360 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-10-2016, 07:24 PM
  3. Using Check Box to unhide rows on different worksheet...
    By bencon84 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-10-2014, 06:21 PM
  4. Filtering rows in a column based on a string value search in excel worksheet.
    By Lifeseeker in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-06-2012, 01:58 PM
  5. Replies: 1
    Last Post: 03-11-2011, 07:26 PM
  6. Check if Value Exists in Range For Worksheet Filtering
    By DGA2008 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-03-2009, 12:03 PM
  7. VBA that removes duplicate rows
    By Blindbert in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-21-2007, 12:32 PM

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