Hi,

I currently have a spreadsheet that is being populated by a dataflow. I have conditional formatting (through excel) set up so entire rows are highlighted red if the value in Column G is negative.

The macro then auto filters this sheet to the cells highlighted in Red and copies those values over to another sheet in the workbook.

After the values are copied, I want to delete them from this original table as the rest of the values are going to be copied into another sheet where I can't include the negative numbers.

Every time I run the macro I get:

Run-time error '1004': Delete method of Range class failed

Sub Negative_HoursV2()
    Worksheets("Negative Hours").Rows(2 & ":" & Worksheets("Negative Hours").Rows.Count).Delete
    Set sh = Worksheets("Power Bi - InEight_TimeCard")
    Dim rang As Range
    
    With Sheets("Power Bi - InEight_TimeCard")
        If .AutoFilterMode Or .FilterMode = True Then .AutoFilterMode = False
        sh.UsedRange.AutoFilter 1, RGB(255, 0, 0), xlFilterCellColor
        
        Set rang = sh.UsedRange.Offset(1, 0)
        Set rang = rang.Resize(rang.Rows.Count - 1)
        
        On Error Resume Next
        Set rang = rang.SpecialCells(xlCellTypeVisible)
        
        If Err.Number = 0 Then
            rang.Copy
            Worksheets("Negative Hours").Range("A2").PasteSpecial Paste:=xlPasteValues
        End If
        
        On Error GoTo 0
        
        rang.EntireRow.Delete
        
    End With
    If Sheets("Power BI - InEight_TimeCard").FilterMode = True Then Sheets("Power BI - InEight_TimeCard").ShowAllData
        
        
  End Sub