Sub ClearReportsButton()
    Dim ws As Worksheet
    Dim wsArr As Variant
    Dim i As Integer
    
    ' Define sheets to keep
    wsArr = Array("Dashboard", "Datasheet", "Code")
    
    Application.ScreenUpdating = False
    Application.DisplayAlerts = False
    
    ' Loop backwards to avoid deletion issues
    For i = ThisWorkbook.Sheets.Count To 1 Step -1
        Set ws = ThisWorkbook.Sheets(i)
        If Not IsInArray(ws.Name, wsArr) Then
            ws.Delete
        End If
    Next i

    Application.DisplayAlerts = True
    Application.ScreenUpdating = True
    MsgBox "All county reports have been cleared!", vbInformation
End Sub

' Function to check if sheet name is in the list of sheets to keep
Function IsInArray(val As String, arr As Variant) As Boolean
    Dim i As Integer
    For i = LBound(arr) To UBound(arr)
        If arr(i) = val Then
            IsInArray = True
            Exit Function
        End If
    Next i
    IsInArray = False
End Function