Code below was working. Can't seem to figure out what changed. It errors out at
Firstrow = .UsedRange.Offset(1).Row
Application defined or object defined error.
First row shows 0 in the highlighted code.
The sheet has a query which pulls in data in a data table.
I've even tried using the ListObjects(1).Unlist to see if it had a problem with the table but still error.
Any assist is appreciated.
 ```Sub Delete_Rows_Individual()
    Dim Firstrow As Long
    Dim Lastrow As Long
    Dim Lrow As Long
    Dim CalcMode As Long
    Dim ViewMode As Long
    Dim rng As Range
    With ActiveSheet
        .Select
        ViewMode = ActiveWindow.View
        ActiveWindow.View = xlNormalView
        'Set the first and last row to loop through
        Firstrow = .UsedRange.Offset(1).Row
        Lastrow = .UsedRange.Rows(.UsedRange.Rows.Count).Row
        'Loop from Lastrow to Firstrow (bottom to top)
        For Lrow = Lastrow To Firstrow Step -1
            'Check the values in the A column
            With .Cells(Lrow, "A")
                If Not IsError(.Value) Then
                    If .Value <> Worksheets("Variables").Range("B12") Then
                        If rng Is Nothing Then
                            Set rng = .Cells
                        Else
                            Set rng = Application.Union(rng, .Cells)
                        End If
                    End If
                End If
            End With
        Next Lrow
    End With
    'Delete all rows at once
    If Not rng Is Nothing Then rng.EntireRow.Delete
    ActiveWindow.View = ViewMode
    With Application
        .ScreenUpdating = True
        .Calculation = CalcMode
    End With
End Sub```
UPDATE: The above code works in other files that are basically the same. They use data tables, use the exact same code, but do not error out. Don't know if this helps but wanted to include.
