+ Reply to Thread
Results 1 to 6 of 6

VBA Error - No cells were found

  1. #1
    Registered User
    Join Date
    05-22-2021
    Location
    US
    MS-Off Ver
    Excel 365
    Posts
    58

    VBA Error - No cells were found

    Help! I am getting an error (No cells were found) on the below code. There are headers in row 1 with the starting in row 2. There is data in every row n column F. The code does multiple filters for each category with the code below showing the filter for Group1 category (there are several groups). When filtered, if a particular group does not have any data for that day, then I am trying to create a new tab with the filter name along with comments on that new sheet. This is so, audit will know review this filter was completed and not overlooked. However, if a group does have data when filtered, then the filtered data (without headers) will be copied onto a sheet at the next empty row with all of the filtered data (Final sheet). I am getting an error message at the line noted below in the code.


    I appreciate all help!
    Also, I'm trying so hard to learn, so I would very much appreciate any explanation to code provided.


    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: VBA Error - No cells were found


    Correct the address on the above If codeline ! Just checking a single column …
    And you can get rid of SpecialCells - useless here ! - just using Range.Copy method.
    For more help attach at least a workbook …

  3. #3
    Registered User
    Join Date
    05-22-2021
    Location
    US
    MS-Off Ver
    Excel 365
    Posts
    58

    Re: VBA Error - No cells were found

    Hi Marc. I am attaching a sample workbook of dummy data and some dummy headings with a small number of rows. The number of columns is correct. As I previously mentioned, there are several filters so hoping for the code that I had written to be generic for each filter with the exception of me changing the column number and criteria. So when I have the code working for one filter, I'm hoping that it would be a matter of copying the working and adding to the end; then update the column filter and criteria for each filter. As I mentioned, I'm learning. I included a tab to show the various filters and how they are not always the same column being filtered each time.

    So are saying that the range is what is causing the 'No cells found' error message?
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    05-22-2021
    Location
    US
    MS-Off Ver
    Excel 365
    Posts
    58

    Re: VBA Error - No cells were found

    I attached a workbook below.

    I have re-read your message and thought you were saying range was causing message but no. Sounds like you are saying that my issue is the line above where the Debug hits.
    Thanks for responding and trying to help me.

  5. #5
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: VBA Error - No cells were found


    According to your attachment the message is true : nothing matches the filter criteria so the reason why crashes the useless SpecialCells
    where checking first on a different range has no sense !
    As it seems obvious you tried to filter a wrong column so just well elaborate what exactly is your need in order there is nothing to guess …

  6. #6
    Registered User
    Join Date
    05-22-2021
    Location
    US
    MS-Off Ver
    Excel 365
    Posts
    58

    Re: VBA Error - No cells were found

    Ah.... got it. I guess I needed another pair of eyes!
    Thank you!!!

+ 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] Run Time Error-1004 -No cells were found
    By Etax in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-27-2023, 11:30 AM
  2. No Cells Found VBA Error
    By ktfrrll in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-16-2018, 08:25 PM
  3. [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
  4. [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
  5. [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
  6. [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
  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

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