I think I have been staring at this too long - just cant see where I am going wrong with the coding below. The whole spreadsheet is aimed at helping the teachers at my school with their tracking etc.

Sheets 26 to 28 have either M or F in Column G, which is filtered in the first part of the coding.

If I run it with 'M' as criteria it works great, as soon as I change to 'F' it does all I ask, but I get a RunTime Error 13 'type mismatch' and the end.

YET if I run Part 1 and Part 2 separately they work well.

Any ideas?

Thanks



Sub filtergirls()
Application.ScreenUpdating = False

'PART 1
Range(ActiveCell.Address).Name = "StartCell"

      Dim q As Integer
    For q = 26 To Worksheets.Count
        With Worksheets(q)
    .AutoFilterMode = False
    .Range("B4:DZ" & .Cells.Find("*", , , , 1, 2).Row).AutoFilter Field:=6, Criteria1:="F"
                End With
    Next q
             Sheets("Analysis AUT").Range("$M$2").Value = "(Girls Only)"
             Sheets("Analysis SPR").Range("$M$2").Value = "(Girls Only)"
             Sheets("Analysis SUM").Range("$M$2").Value = "(Girls Only)"
                      Application.DisplayStatusBar = True
    Application.StatusBar = "Filter: GIRLS"
       Dim cell As Range
    Application.ScreenUpdating = False
    

'part 2
        Dim b As Integer
    For b = 5 To 17
    
    Worksheets(b).Activate
    ActiveSheet.Unprotect Password:="Teacher1971"
     For Each cell In Intersect(Sheets(b).UsedRange, Range("C103:DZ103"))
        cell.EntireColumn.Hidden = cell.Value = 1 And Not IsEmpty(cell)
    Next cell
    ActiveSheet.Protect Password:="Teacher1971", UserInterFaceOnly:=True, AllowFiltering:=True, AllowSorting:=True
    Next b
    
   Worksheets(3).Activate

Application.GoTo "StartCell"


End Sub