Boucles par mois

Bonjour,

J'ai une maccro permettant d'écrire des 1 dans des cases en fonction des jours du mois renant en compte les jours de congés et férié et les Samedis noté S et les dimanches noté D

Ma macro fonctionne bien pour le 1er mois (en l'occurance Colonne 35 à colonne 65 (mois de septembre)) mais pas pour les mois suivants.

Comment puis-je lui dire de faire des boucles sachant que certains mois il y a 30j ou 28/29j ou 31j

Merci de votre aide

 ElseIf Worksheets(tableau).Cells(pRow, pVerifCol) = "M" Then
            rechercheCol = 35

            While Worksheets(tableau).Cells(3, rechercheCol) <> ""

                If Day(Worksheets(tableau).Cells(3, rechercheCol)) = 1 Then
                    mi1 = mi1 + 1
                    mCol = rechercheCol - 2
                    mPlus = 0

mti:
                    cClean = False
                    While Worksheets(feuilleConges).Cells(congesRow, mCongCol + Worksheets(tableau).Cells(pRow, pRefCol) + mPlus) <> ""
                        mPlus = mPlus + 1
                        cClean = True
                    Wend

                    If Worksheets(tableau).Cells(2, mCol + Worksheets(tableau).Cells(pRow, pRefCol) + mPlus) = "S" Then
                        mPlus = mPlus + 2
                        cClean = True
                    End If

                    If Worksheets(tableau).Cells(2, mCol + Worksheets(tableau).Cells(pRow, pRefCol) + mPlus) = "D" Then
                        mPlus = mPlus + 1
                        cClean = True
                    End If

                    If cClean Then GoTo mti

                    Worksheets(tableau).Cells(pRow, mCol + Worksheets(tableau).Cells(pRow, pRefCol) + mPlus) = 1
                    mPre = Worksheets(tableau).Cells(pRow, pRefCol)

                End If

            rechercheCol = rechercheCol + 1
            Wend

Bonjour

pour le nombre de jour par mois a voir

Sub TestNombJour()
An = 2019
Mois = 2
    MsgBox Day(DateSerial(An, Mois + 1, 1) - 1)

    For J = 1 To Day(DateSerial(An, Mois + 1, 1) - 1)
        ' Code
    Next
End Sub

A+

Maurice

Oui je vois

Comment répéter cette boucle pour les mois suivants ?

Personne n'a de solution à mon ptit problème ?

Rechercher des sujets similaires à "boucles mois"