countif syntahx in vba
<p>I was coding a loop, and i was wondering why my macro doesn't work. The idea of the macro is to determine the month's number of weeks. With knowing the name of the fisrt workday of a month i can countif the number of this occurence in a range of week's day. Her it is :</p>

<pre><code>Dim dbNbSemaines As Double
Dim strAbrevJourMois As String

strAbrevJourMois = Range("E4").Value

If strAbrevJourMois = "lun" Then
Range("A404").FormulaR1C1 = "=COUNTIF(E4:AB4,""lun"")"
    dbNbSemaines = Range("A404").Value

ElseIf strAbrevJourMois = "mar" Then
    Range("A404").FormulaR1C1 = "=COUNTIF(E4:AB4,""mar"")"
    dbNbSemaines = Range("A404").Value

ElseIf strAbrevJourMois = "mer" Then
    Range("A404").FormulaR1C1 = "=COUNTIF(E4:AB4,""mer"")"
    dbNbSemaines = Range("A404").Value

ElseIf strAbrevJourMois = "jeu" Then
    Range("A404").FormulaR1C1 = "=COUNTIF(E4:AB4,""jeu"")"
    dbNbSemaines = Range("A404").Value

ElseIf strAbrevJourMois = "ven" Then
    Range("A404").FormulaR1C1 = "=COUNTIF(E4:AB4,""ven"")"
    dbNbSemaines = Range("A404").Value
</code></pre>

<p>End If</p>

<p>When i go to the A404 cell that contains the countif formula it returns a <code>#NOM?</code> and it contains a <code>=NB.SI('E4':'AB4';"lun")</code>. How can i write it in vba to insert the range E4:AB4 in the COUNTIF formula ?</p>

<p>Thanks for your help </p>