The 'dot' is looking for a reference to something that identifies the .EntireRow

Try


cell.entireRow.Hidden = True
where 'cell' identifies the .EntireRow



In your original, I think you just had the 'next cell' and the 'End If' out of order

The 'If cell.Value = "n"' line does not require a 'End If' since it's a single line statement

Sub HideRows_Based_On_Values()
    If Range("C2").Value = "n" Then
        For Each cell In Range("c3:c20")
            If cell.Value = "n" Then cell.EntireRow.Hidden = True
        Next cell' <<<<<
    End If  ' <<<<<<
End Sub

It's a little easier to see when you use a more standard indent approach