Boucle hebdomadaire

Bonjour,

Mon code ci-dessous me permet d'afficher des "1" dans la premiere semaine (colonne 34 à 39) selon quelques conditions.

Je voudrais répeter la macro en faisant hcol=hcol+7 et hConCol = hCongCol +7

Repeter jusqu'à ligne 3 colonne X vide

Comment puis-je réaliser cette boucle ?

(Le code est plus complet que ça d'où les "..."

congesRow = 7 
tableau = "PlanningHebdo" 
feuilleConges = "Congés"

'---Hebdomadaire----------
    hcol = 34
    hCongCol = 253

    hPlus = 0
    hVerif = False
    hPre = 0

    '---Planning-------
    pRefCol = 10
    pVerifCol = 3
    pRow = 5
    break = True

 ....

ElseIf Worksheets(tableau).Cells(pRow, pVerifCol) = "H" Then

hti:
                cClean = False
                While Worksheets(feuilleConges).Cells(congesRow, hCongCol + Worksheets(tableau).Cells(pRow, pRefCol) + hPlus) <> ""
                    hPlus = hPlus + 1
                    cClean = True
                Wend

                If cClean Then GoTo hti

                Worksheets(tableau).Cells(pRow, hcol + Worksheets(tableau).Cells(pRow, pRefCol) + hPlus) = 1

End If

...

Salut,

Difficile avec juste un petit bout de code qui démarre au milieu d'un if :s

Mais je serais parti sur un truc comme ça :

For i = 1 To 52

While Worksheets(feuilleConges).Cells(congesRow, hCongCol * i + Worksheets(tableau).Cells(pRow, pRefCol) + hPlus) <> ""
                    hPlus = hPlus + 1
                    cClean = True
                Wend

                If cClean Then GoTo hti

                Worksheets(tableau).Cells(pRow, hcol * i + Worksheets(tableau).Cells(pRow, pRefCol) + hPlus) = 1
Next

Girodo,

Oue pas facile

Marche po ...

Voici ce que j'ai : Macro : Module15 pour ce que je souhaite

https://www.cjoint.com/c/IIuirZlLqhl

Rechercher des sujets similaires à "boucle hebdomadaire"