Erreur compilation Else sans If

Résolu/Fermé
azathothnotsuki - Modifié par Chris 94 le 21/05/2016 à 00:26
 azathothnotsuki - 21 mai 2016 à 10:59
Bonjour, je ne comprends pas ou est l'erreur,
il surligne le dernier else tout à la fin...
merci de votre aide...





Sub Finaliser_Setlist()

Dim Lig_Lecture_Final As Long
Dim Col_Lecture_Final As Long
Dim Lig_Ecriture_Final As Long
Dim Col_Ecriture_Final As Long
Dim Lig_Infos_Final As Long
Dim Col_Infos_Final As Long
Dim Lig_Album_Final As Long
Dim Col_Album_Final As Long
Dim Titre_Select_Final As String
Dim Titre_Complet_Find_Final As Object
Dim Titre_Complet_Final As String
Dim Titre_Find_Final As Object
Dim Numero_Titre_Final As String
Dim k As Long
Dim l As Long
Dim m As Long

Dim n As Long
Dim o As Long
Dim p As Long
Dim q As Long
Dim r As Long
Dim s As Long
Dim t As Long
Dim u As Long
Dim v As Long
Dim w As Long

Lig_Lecture_Final = 6
Col_Lecture_Final = 1
Lig_Ecriture_Final = 6
Col_Ecriture_Final = 1
Nb_Chansons = Sheets("SETLIST").Cells(2, 16)
l = 33
m = 6

n = 3
o = 3
p = 3
q = 3
r = 3
s = 3
t = 3
u = 3
v = 3
w = 3

If Sheets("SETLIST").Cells(2, 9) = "1" Then

    While l <= 157
        Sheets("SETLIST").Cells(l, 1) = Sheets("SETLIST").Cells(2, 1)
        Sheets("SETLIST").Cells(l + 1, 1) = Sheets("SETLIST").Cells(3, 1)
        l = l + 31
    Wend
    For k = 0 To Nb_Chansons + 2
        Lig_Lecture_Final = Lig_Lecture_Final + k
        Numero_Titre_Final = Sheets("SETLIST").Cells(Lig_Lecture_Final, Col_Lecture_Final)
        If Numero_Titre_Final <> "" Then
            If Numero_Titre_Final = 0 Then
                Titre_Select_Final = Sheets("SETLIST").Cells(Lig_Lecture_Final, Col_Lecture_Final + 4)
                Set Titre_Complet_Find_Final = Sheets("TITRES").Range("B1:B150").Find(Titre_Select_Final)
                Titre_Complet_Final = Sheets("TITRES").Cells(Titre_Complet_Find_Final.Row, 3)
                Sheets("SETLIST").Cells(Lig_Ecriture_Final, Col_Ecriture_Final + 5) = Sheets("COMPOSITION DES LISTES").Cells(44, 3)
                Sheets("SETLIST").Cells(Lig_Ecriture_Final + 31, Col_Ecriture_Final) = Numero_Titre_Final
                Sheets("SETLIST").Cells(Lig_Ecriture_Final + 31, Col_Ecriture_Final + 4) = Titre_Select_Final
                Sheets("SETLIST").Cells(Lig_Ecriture_Final + 31, Col_Ecriture_Final + 5) = Sheets("COMPOSITION DES LISTES").Cells(44, 3)
                Sheets("SETLIST").Cells(Lig_Ecriture_Final + 62, Col_Ecriture_Final) = Numero_Titre_Final
                Sheets("SETLIST").Cells(Lig_Ecriture_Final + 62, Col_Ecriture_Final + 4) = Titre_Select_Final
                Sheets("SETLIST").Cells(Lig_Ecriture_Final + 62, Col_Ecriture_Final + 5) = Sheets("COMPOSITION DES LISTES").Cells(44, 3)
                Sheets("SETLIST").Cells(Lig_Ecriture_Final + 93, Col_Ecriture_Final) = Numero_Titre_Final
                Sheets("SETLIST").Cells(Lig_Ecriture_Final + 93, Col_Ecriture_Final + 4) = Titre_Select_Final
                Sheets("SETLIST").Cells(Lig_Ecriture_Final + 93, Col_Ecriture_Final + 5) = Sheets("COMPOSITION DES LISTES").Cells(44, 3)
                Sheets("SETLIST").Cells(Lig_Ecriture_Final + 124, Col_Ecriture_Final) = Numero_Titre_Final
                Sheets("SETLIST").Cells(Lig_Ecriture_Final + 124, Col_Ecriture_Final + 4) = Titre_Complet_Final
                Sheets("SETLIST").Cells(Lig_Ecriture_Final + 124, Col_Ecriture_Final + 5) = Sheets("COMPOSITION DES LISTES").Cells(44, 3)
                Sheets("SETLIST").Cells(Lig_Ecriture_Final + 155, Col_Ecriture_Final) = Numero_Titre_Final
                Sheets("SETLIST").Cells(Lig_Ecriture_Final + 155, Col_Ecriture_Final + 4) = Titre_Complet_Final
                Sheets("SETLIST").Cells(Lig_Ecriture_Final + 155, Col_Ecriture_Final + 5) = Sheets("COMPOSITION DES LISTES").Cells(44, 3)
            Else
                Titre_Select_Final = Sheets("SETLIST").Cells(Lig_Lecture_Final, Col_Lecture_Final + 4)
                Lig_Infos_Final = Application.Match(Titre_Select_Final, Sheets("CLASSEMENT INFOS").Range("A1:A150"), 0)
                Set Titre_Find_Final = Sheets("TOTAL PAR ALBUM").Range("B4:K31").Find(Titre_Select_Final)
                Lig_Album_Final = Titre_Find_Final.Row
                Col_Album_Final = Titre_Find_Final.Column
                Set Titre_Complet_Find_Final = Sheets("TITRES").Range("B1:B150").Find(Titre_Select_Final)
                Titre_Complet_Final = Sheets("TITRES").Cells(Titre_Complet_Find_Final.Row, 3)
                Sheets("SETLIST").Cells(Lig_Ecriture_Final + 31, Col_Ecriture_Final) = Numero_Titre_Final
                Sheets("SETLIST").Cells(Lig_Ecriture_Final + 31, Col_Ecriture_Final + 4) = Titre_Select_Final
                Sheets("SETLIST").Cells(Lig_Ecriture_Final + 62, Col_Ecriture_Final) = Numero_Titre_Final
                Sheets("SETLIST").Cells(Lig_Ecriture_Final + 62, Col_Ecriture_Final + 4) = Titre_Select_Final
                Sheets("SETLIST").Cells(Lig_Ecriture_Final + 93, Col_Ecriture_Final) = Numero_Titre_Final
                Sheets("SETLIST").Cells(Lig_Ecriture_Final + 93, Col_Ecriture_Final + 4) = Titre_Select_Final
                Sheets("SETLIST").Cells(Lig_Ecriture_Final + 124, Col_Ecriture_Final) = Numero_Titre_Final
                Sheets("SETLIST").Cells(Lig_Ecriture_Final + 124, Col_Ecriture_Final + 4) = Titre_Complet_Final
                Sheets("SETLIST").Cells(Lig_Ecriture_Final + 155, Col_Ecriture_Final) = Numero_Titre_Final
                Sheets("SETLIST").Cells(Lig_Ecriture_Final + 155, Col_Ecriture_Final + 4) = Titre_Complet_Final
                Sheets("SETLIST").Cells(Lig_Ecriture_Final, 2) = Sheets("TOTAL PAR ALBUM").Cells(Lig_Infos_Final, 7)
                Sheets("SETLIST").Cells(Lig_Ecriture_Final + 31, 2) = Sheets("TOTAL PAR ALBUM").Cells(Lig_Infos_Final, 7)
                Sheets("SETLIST").Cells(Lig_Ecriture_Final + 62, 2) = Sheets("TOTAL PAR ALBUM").Cells(Lig_Infos_Final, 7)
                Sheets("SETLIST").Cells(Lig_Ecriture_Final + 93, 2) = Sheets("TOTAL PAR ALBUM").Cells(Lig_Infos_Final, 7)
                Sheets("SETLIST").Cells(Lig_Ecriture_Final + 124, 2) = Sheets("TOTAL PAR ALBUM").Cells(Lig_Infos_Final, 7)
                Sheets("SETLIST").Cells(Lig_Ecriture_Final + 155, 2) = Sheets("TOTAL PAR ALBUM").Cells(Lig_Infos_Final, 7)
                Sheets("SETLIST").Cells(Lig_Ecriture_Final, 6) = Sheets("TOTAL PAR ALBUM").Cells(Lig_Infos_Final, 8)
                Sheets("SETLIST").Cells(Lig_Ecriture_Final + 31, 6) = Sheets("TOTAL PAR ALBUM").Cells(Lig_Infos_Final, 8)
                Sheets("SETLIST").Cells(Lig_Ecriture_Final + 62, 6) = Sheets("TOTAL PAR ALBUM").Cells(Lig_Infos_Final, 8)
                Sheets("SETLIST").Cells(Lig_Ecriture_Final + 93, 6) = Sheets("TOTAL PAR ALBUM").Cells(Lig_Infos_Final, 8)
                Sheets("SETLIST").Cells(Lig_Ecriture_Final + 124, 6) = Sheets("TOTAL PAR ALBUM").Cells(Lig_Infos_Final, 8)
                Sheets("SETLIST").Cells(Lig_Ecriture_Final + 155, 6) = Sheets("TOTAL PAR ALBUM").Cells(Lig_Infos_Final, 8)
                Sheets("SETLIST").Cells(Lig_Ecriture_Final, 7) = Sheets("TOTAL PAR ALBUM").Cells(Lig_Infos_Final, 9)
                Sheets("SETLIST").Cells(Lig_Ecriture_Final + 31, 7) = Sheets("TOTAL PAR ALBUM").Cells(Lig_Infos_Final, 9)
                Sheets("SETLIST").Cells(Lig_Ecriture_Final + 62, 7) = Sheets("TOTAL PAR ALBUM").Cells(Lig_Infos_Final, 9)
                Sheets("SETLIST").Cells(Lig_Ecriture_Final + 93, 7) = Sheets("TOTAL PAR ALBUM").Cells(Lig_Infos_Final, 9)
                Sheets("SETLIST").Cells(Lig_Ecriture_Final + 124, 7) = Sheets("TOTAL PAR ALBUM").Cells(Lig_Infos_Final, 9)
                Sheets("SETLIST").Cells(Lig_Ecriture_Final + 155, 7) = Sheets("TOTAL PAR ALBUM").Cells(Lig_Infos_Final, 9)
                Sheets("SETLIST").Cells(Lig_Ecriture_Final, 3) = Sheets("TOTAL PAR ALBUM").Cells(Lig_Infos_Final, 2)
                Sheets("SETLIST").Cells(Lig_Ecriture_Final, 4) = Sheets("TOTAL PAR ALBUM").Cells(Lig_Infos_Final, 3)
                Sheets("SETLIST").Cells(Lig_Ecriture_Final + 31, 3) = Sheets("TOTAL PAR ALBUM").Cells(Lig_Infos_Final, 4)
                Sheets("SETLIST").Cells(Lig_Ecriture_Final + 62, 3) = Sheets("TOTAL PAR ALBUM").Cells(Lig_Infos_Final, 5)
                Sheets("SETLIST").Cells(Lig_Ecriture_Final + 93, 3) = Sheets("TOTAL PAR ALBUM").Cells(Lig_Infos_Final, 6)
                Select Case Col_Album_Final
                    Case Is = 2
                        Sheets("SETLIST").Cells(n, 20) = 1
                        n = n + 1
                    Case Is = 3
                        Sheets("SETLIST").Cells(o, 21) = 1
                        o = o + 1
                    Case Is = 4
                        Sheets("SETLIST").Cells(p, 22) = 1
                        p = p + 1
                    Case Is = 5
                        Sheets("SETLIST").Cells(q, 23) = 1
                        q = q + 1
                    Case Is = 6
                        Sheets("SETLIST").Cells(r, 24) = 1
                        r = r + 1
                    Case Is = 7
                        Sheets("SETLIST").Cells(s, 25) = 1
                        s = s + 1
                    Case Is = 8
                        Sheets("SETLIST").Cells(t, 26) = 1
                        t = t + 1
                    Case Is = 9
                        Sheets("SETLIST").Cells(u, 27) = 1
                        u = u + 1
                    Case Is = 10
                        Sheets("SETLIST").Cells(v, 28) = 1
                        v = v + 1
                    Case Is = 11
                        Sheets("SETLIST").Cells(w, 29) = 1
                        w = w + 1
                End Select
            End If
        Else
            Lig_Ecriture_Final = Lig_Ecriture_Final + 1
        End If
Else
    MsgBox "Votre Setlist n'a pas été triée"
End If

End Sub

A voir également:

2 réponses

Utilisateur anonyme
21 mai 2016 à 00:25
Bonjour

À vue de nez, il manque un "Next k" avant le dernier Else
0
azathothnotsuki
21 mai 2016 à 10:59
Merci bcp.
C'était ça bien sûr,
Si il avait dit for sans next ça aurait été plus simple....
0