No Cells Were Found Error when Macro is Run

Jett Midknight

Board Regular
Joined
Jan 8, 2014
Messages
110
So when I go to run a macro, it won't run at all, and I keep getting a "No Cells Were Found" pop up. I'm not sure why, seeing as how this macro worked fine yesterday. I tried stepping through the macro to find where it fails at, and it goes through the entire macro fine without any errors, yet when I try to run the entire macro, it fails. Any idea why> I am running Excel 2010. I have searched all over the web and forums trying to find an answer to this issue, and I have fouund nothing.
 
I get an error regardless of whether the code is in the Personal Macro Workbook or the actual Workbook on the first line:
Code:
    ActiveSheet.ShowAllData
I think that is because none of the data is hidden/filtered at the beginning. When I replaced the line above with this:
Code:
'   If all data is already shown, bypass error
    On Error Resume Next
    ActiveSheet.ShowAllData
    On Error GoTo 0
the code ran without error in both instances.
 
Upvote 0

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
I don't think that was the problem because the error that line produced was not the No Cells Found Error, at least not in my usage of it. Also when testing it I always made sure that I had some form of filter active. Either way I did find a fix for it. I simply copied the code and created a new macro and it ran fine. I thank you for all of your help though.
 
Upvote 0
There must have been something else going on that we were unaware about, as I did not have that same issue on my end.
While I am curious as to what that might have been, the important thing is that you got it working.
It might have something to do with your environment, which obviously I cannot fully reproduce here.
 
Upvote 0

Forum statistics

Threads
1,216,562
Messages
6,131,422
Members
449,651
Latest member
Jacobs22

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top