in vba excel Im trying to do a countifs like function counting how many fit 2 cirteria. Little experience

Solution for in vba excel Im trying to do a countifs like function counting how many fit 2 cirteria. Little experience
is Given Below:

The problem is that when I F5, it crashes. when i F8, its looping in the for loop, but the value of none of the totals are changing. I know this because as I hover, the value is still reading 0. Again, Im a novice so excuse if the code looks clunky.

Dim mycell As Range
Dim mycell_nw As Range
Dim myrange As Range
Dim myrange_nw As Range

Dim MaleTotal As Integer
Dim FemaleTotal As Integer
Dim UnTotal As Integer


Set myrange = Sheets("inforce").Range("ei:ei")
Set myrange_nw = Sheets("inforce").Range("ej:ej")


MaleTotal = 0
FemaleTotal = 0
UnTotal = 0

For Each mycell In myrange
For Each mycell_nw In myrange_nw
If mycell.Value = "M" And mycell_nw.Value = 0 Then
MaleTotal = MaleTotal + 1


ElseIf mycell.Value = "F" And mycell_nw.Value = 0 Then
FemaleTotal = FemaleTotal + 1


ElseIf mycell.Value = "U" And mycell_nw.Value = 0 Then
UnTotal = UnTotal + 1
End If
Next mycell_nw
Next mycell

just use Application.CountIfs()

With Worksheets("inforce")
    Dim myrange As Range
    Set myrange = .Range("ei:ei")
    
    Dim myrange_nw As Range
    Set myrange_nw = .Range("ej:ej")
End With
    
Dim MaleTotal As Long
MaleTotal = Application.CountIfs(myrange, "M", myrange_nw, 0)

Dim FemaleTotal As Long
FemaleTotal = Application.CountIfs(myrange, "F", myrange_nw, 0)

Dim UnTotal As Long
UnTotal = Application.CountIfs(myrange, "U", myrange_nw, 0)

If you do not want to use COUNTIFS then iterate an array not a range:

With Worksheets("inforce")
    Dim myrange As Range
    Set myrange = Intersect(.UsedRange, .Range("ei:ej"))
    
    Dim myrange_array As Variant
    myrange_array = myrange.Value
End With

Dim MaleTotal As Long
MaleTotal = 0

Dim FemaleTotal As Long
FemaleTotal = 0

Dim UnTotal As Long
UnTotal = 0

Dim i As Long
For i = 1 To UBound(myrange_array, 1)
    If myrange_array(i, 2) = 0 Then
        If myrange_array(i, 1) = "M" Then MaleTotal = MaleTotal + 1
        If myrange_array(i, 1) = "F" Then FemaleTotal = FemaleTotal + 1
        If myrange_array(i, 1) = "U" Then UnTotal = UnTotal + 1
    End If
Next i