+ Reply to Thread
Results 1 to 3 of 3

No Cells Found VBA Error

  1. #1
    Registered User
    Join Date
    12-16-2018
    Location
    Erie, Pennsylvania
    MS-Off Ver
    MSO 2016
    Posts
    1

    No Cells Found VBA Error

    Hello,

    I have a line of code that counts the number of rows in the table and enters that count into a specified cell. Previous lines of code filter the table down base upon certain criteria. This code works well except when there are no rows. How can I modify this so that if no rows are found, the value for the specified cell is just set to zero?

    Cells(2, 6).Value = (Sheets("Sheet1").Range("Table1").SpecialCells(xlCellTypeVisible).Rows.Count)

    Thanks in advance!

  2. #2
    Forum Contributor
    Join Date
    01-09-2016
    Location
    Perth Western Australia
    MS-Off Ver
    Office 365
    Posts
    257

    Re: No Cells Found VBA Error

    Hi

    Try
    Please Login or Register  to view this content.
    Note I have not tested this.

    Cheers
    Last edited by FoxSeaLady; 12-16-2018 at 08:18 PM. Reason: Ommitted code End If

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,463

    Re: No Cells Found VBA Error

    Maybe
    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


+ 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. [SOLVED] Sum Multiple Cells Ignoring Error if found in one of the Cells
    By ssanjju in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-26-2014, 09:07 PM
  2. [SOLVED] Run-time error. No cells were found
    By wonderd in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-13-2014, 04:52 AM
  3. [SOLVED] Error: No cells were found
    By Excel_vba in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 12-29-2013, 02:49 AM
  4. [SOLVED] Cells not found error for autofilter
    By arlu1201 in forum Excel Programming / VBA / Macros
    Replies: 28
    Last Post: 07-09-2013, 06:24 AM
  5. Run-time error '1004': No cells were found
    By tirk82 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-24-2012, 12:48 PM
  6. Please help, 1004 error no cells found workaround
    By baseballtheory in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-17-2005, 06:41 AM
  7. [SOLVED] Run-time error '1004': No cells were found
    By Jamie in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-16-2005, 06:06 PM

Tags for this Thread

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