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.
 
Out of curiosity, if you copy the complete macro from your Personal Macro Workbook into your working Excel Workbook and run it, does it still have the same issue?
 
Upvote 0

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
If it isn't running (maybe because your macros aren't enabled), I suspect you wouldn't get any message at all.

It looks like you only posted an excerpt of your code. Is there more?

This problem might be hard to diagnose without seeing your full code and sample data, so we can try it under the same circumstances you are.
 
Upvote 0
Full code. It is a bit repetitive.
Code:
Sub IRT_2()'
' IRT_2 Macro
'
' Keyboard Shortcut: Ctrl+Shift+O
'
    Dim nrows As Long
    
    ActiveSheet.ShowAllData
    ActiveSheet.Range("$A$2:$BD$5000").AutoFilter Field:=3, Criteria1:= _
        "Order Filled"
    Rows("2:2").Select
    r = Selection.Row
    Cells(r + 1, 1).EntireRow.Insert
    Rows("3:3").Select
    With Selection.Interior
        .Pattern = xlNone
        .TintAndShade = 0
        .PatternTintAndShade = 0
    End With
    Selection.Borders(xlDiagonalDown).LineStyle = xlNone
    Selection.Borders(xlDiagonalUp).LineStyle = xlNone
    With Selection.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlInsideVertical)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlInsideHorizontal)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    Selection.Font.Bold = False
    
    nrows = Cells(Rows.Count, "H").End(xlUp).Row


    Range("I3").FormulaR1C1 = "Order Filled"
    Range("J3").FormulaR1C1 = "Order FIlled"
    Range("I3:J3").Copy Range("I3:J" & nrows)
    Rows("3:3").EntireRow.Delete
    ActiveSheet.ShowAllData
    
    
    ActiveSheet.Range("$A$2:$BD$5000").AutoFilter Field:=3, Criteria1:=Array( _
        "Impound", "Late", "NP", "On Time", "Past Due"), Operator:=xlFilterValues
    ActiveSheet.Range("$A$2:$BD$5000").AutoFilter Field:=26, Criteria1:="A"
     Rows("2:2").Select
    r = Selection.Row
    Cells(r + 1, 1).EntireRow.Insert
    Rows("3:3").Select
    With Selection.Interior
        .Pattern = xlNone
        .TintAndShade = 0
        .PatternTintAndShade = 0
    End With
    Selection.Borders(xlDiagonalDown).LineStyle = xlNone
    Selection.Borders(xlDiagonalUp).LineStyle = xlNone
    With Selection.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlInsideVertical)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlInsideHorizontal)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    Selection.Font.Bold = False
    
    nrows = Cells(Rows.Count, "H").End(xlUp).Row


    Range("I3").FormulaR1C1 = "apprd rb okay"
    Range("J3").FormulaR1C1 = "apprd rb okay"
    Range("I3:J3").Copy Range("I3:J" & nrows)
    Rows("3:3").EntireRow.Delete
    
    ActiveSheet.Range("$A$2:$BD$2960").AutoFilter Field:=19, Criteria1:=RGB(238 _
        , 236, 225), Operator:=xlFilterCellColor
        
    Rows("2:2").Select
    r = Selection.Row
    Cells(r + 1, 1).EntireRow.Insert
    Rows("3:3").Select
    With Selection.Interior
        .Pattern = xlNone
        .TintAndShade = 0
        .PatternTintAndShade = 0
    End With
    Selection.Borders(xlDiagonalDown).LineStyle = xlNone
    Selection.Borders(xlDiagonalUp).LineStyle = xlNone
    With Selection.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlInsideVertical)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlInsideHorizontal)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    Selection.Font.Bold = False


    nrows = Cells(Rows.Count, "H").End(xlUp).Row
    
    Range("I3").FormulaR1C1 = "rb late"
    Range("J3").FormulaR1C1 = "rb late"
    Range("I3:J3").Copy Range("I3:J" & nrows)
    Rows("3:3").EntireRow.Delete
    ActiveSheet.ShowAllData
        
    ActiveSheet.Range("$A$2:$BD$5000").AutoFilter Field:=3, Criteria1:=Array( _
        "Impound", "Late", "NP", "On Time", "Partial Qty Rcvd", "Past Due"), Operator:=xlFilterValues
    ActiveSheet.Range("$A$2:$BD$5000").AutoFilter Field:=26, Criteria1:=Array( _
        "C", "R", "="), Operator:=xlFilterValues
    Rows("2:2").Select
    r = Selection.Row
    Cells(r + 1, 1).EntireRow.Insert
    Rows("3:3").Select
    With Selection.Interior
        .Pattern = xlNone
        .TintAndShade = 0
        .PatternTintAndShade = 0
    End With
    Selection.Borders(xlDiagonalDown).LineStyle = xlNone
    Selection.Borders(xlDiagonalUp).LineStyle = xlNone
    With Selection.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlInsideVertical)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlInsideHorizontal)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    Selection.Font.Bold = False
    
    nrows = Cells(Rows.Count, "H").End(xlUp).Row


    Range("I3").FormulaR1C1 = "."
    Range("J3").FormulaR1C1 = "."
    Range("I3:J3").Copy Range("I3:J" & nrows)
    Rows("3:3").EntireRow.Delete
    ActiveSheet.ShowAllData
    ActiveSheet.Range("$A$2:$BD$5000").AutoFilter Field:=26, Criteria1:="O"
    ActiveSheet.Range("$A$2:$BD$5000").AutoFilter Field:=9, Criteria1:=Array( _
        ".", "apprvd rb okay", "rb late", "rb R&F"), Operator:=xlFilterValues
End Sub

As for the sample data, I can't really provide that, but I don't think it is a problem with my data that is causing it, as the macro seemed to run fine in any workbook I save it into. The only columns I really deal with are Column C, which has the Order Status, and Column Z which tells me if they are Open orders or Closed orders, and then columns D-J is just various information.
 
Upvote 0
Can you create a real simple example with dummy data, and confirm that the same problems occurs when you try to run your code from your Personal Macro Workbook, then either upload that "dummy" file to a file upload site and provide a link to it, or just do a screen print here of the relevant data?

Then we can try to run it on your exact situation so we are comparing apples-to-apples.
 
Upvote 0
OK. I will take a look at it tonight (my current workplace does not allow me to download files from the net, so I have to do it at home).
 
Upvote 0

Forum statistics

Threads
1,216,111
Messages
6,128,899
Members
449,477
Latest member
panjongshing

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