Bonsoir.
Je ne comprends pas pourquoi mon débogueur me dit "Bloc IF sans endif.", tout en surlignant End Sub.
J'ai trous les If sur une ligne chacun, il me semblait qu'il n'y avait pas besoin de EndIf ?
Une idée rapide à première vue ?
Je ne comprends pas pourquoi mon débogueur me dit "Bloc IF sans endif.", tout en surlignant End Sub.
J'ai trous les If sur une ligne chacun, il me semblait qu'il n'y avait pas besoin de EndIf ?
Une idée rapide à première vue ?
VB:
Sub For_Each_Next_Plage()
Dim FL1 As Worksheet, Cell As Range, Plage As Range
Dim NivInitial As Long
Dim Niv As Long
Dim NivRb As Long
Dim Ligne As Long
Dim Colonne As Long
Dim Text As String
Set FL1 = Worksheets("Autocalc")
NivRb = 0
NivInitial = 0
Niv = 0
Ligne = 2
Colonne = 7
Start:
If Cell(Ligne, Colonne).Interior.Color <> RGB(200, 225, 180) Then GoTo Redo
If Cell(Ligne, Colonne).Interior.Color = RGB(200, 225, 180) Then 'si la cellule est colorée
If Cell(Ligne, Colonne - 1).Interior.Color <> RGB(200, 225, 180) Then 'si c'est la première cellule colorée de la ligne
If Cell(Ligne + 366, Colonne) = "YES" Then NivRb = NivRb + 1 Else If Cell(Ligne + 366, Colonne) = "NO" Then NivInitial = Colonne - 6: Niv = Colonne - 6 'si la case est en reborn OUI, on rajoute un niveau reborn sinon on définit le niveau initial non reborn
If Cell(Ligne, Colonne - 1).Interior.Color = RGB(200, 225, 180) Then 'si c'est pas la première cellule colorée de la ligne
If Cell(Ligne + 366, Colonne) = "YES" Then NivRb = NivRb + 1 Else If Cell(Ligne + 366, Colonne) = "NO" Then Niv = Niv + 1 'Si la case est en reborn, reborn +1, sinon niveau non reborn +1
Redo:
If NvRb = 0 Then Text = "From " & NivInitial & " to " & Niv: Cell(Ligne, 5) = Text Else If NvRb <> 0 Then Text = "From " & NivInitial & " to " & Niv & " RB 1 to " & NvRb: Cell(Ligne, 5) = Text ' affichage du résumé
Colonne = Colonne + 1
If Colonne = 47 Then Colonne = 7: Ligne = Ligne + 1: NivRb = 0: NivInitial = 0: Niv = 0
If Ligne = 355 Then GoTo VeryEnd
GoTo Start
VeryEnd:
End Sub
Dernière édition: