Erreur de compilation

Bonjour à tous,

Me voilà bloqué sur un code <avec "ERREUR DE COMPLILATION FONCTION OU VARIABLE ATTENDU"

Je vous joins ici le code. Pourriez-vous m'aider sur ce code.

Sub Simule2() 'Scores Concours
Dim i As Byte, NbrEq As Byte, NbQ As Byte, Nbr As Byte, J As Byte, Cel As Range, Plg
Dim Tablo() As Integer, RDest As Range, Temp As Integer, Existe As Boolean
    NbrEq = Range("Total_équipes")
 Call ImageSansFormule '####
        If NbrEq > 29 Then NbQ = 3
        If NbrEq < 30 Then NbQ = 2
    If NbrEq <> 8 And NbrEq <> 16 And WorksheetFunction.CountA(Range("Score_Qualif")) / NbQ <> NbrEq Then
        MsgBox ("Les qualifications ne sont pas terminées pour la suite")
        Exit Sub
    End If
    Application.EnableEvents = False
        Range("Scores").ClearContents
    Application.ScreenUpdating = False

        Range("a40:c56").Locked = False

        If NbrEq <> 8 And NbrEq <> 16 Then Range("Qualif!n6:n21").Copy Destination:=Range("c40")
        If NbrEq = 8 Or NbrEq = 16 Then Range("Qualif!m6:m21").Copy Destination:=Range("c40")
        If NbrEq < 16 Then Nbr = 8
        If NbrEq > 15 Then Nbr = 16
        If NbrEq = 8 Or NbrEq = 16 Then Nbr = NbrEq
    ReDim Tablo(Nbr)
            Set RDest = Cells(40, 2)

            Randomize
        For i = 1 To Nbr
            Existe = True
            While Existe
                Temp = Int(Nbr * Rnd + 1)
                For J = 1 To Nbr
                    If Temp = Tablo(J) Then
                        Existe = True
                        Exit For
                    Else
                        Existe = False
                    End If
                Next J
            Wend
            Tablo(i) = Temp
        Next i

        For i = 1 To Nbr
            RDest(i).Value = Tablo(i)
        Next i
    '******
    Range("b40:c56").Sort Key1:=Range("B40"), Order1:=xlAscending, _
    Header:=xlNo, OrderCustom:=1, MatchCase:=False

     Application.ScreenUpdating = True
     Application.EnableEvents = True
    On Error Resume Next
        If Nbr > 8 Then

            For Each Cel In Range("c40:c56")
                Plg = Application.WorksheetFunction.Match(Cel, Range("h5:h35"), 0) + 4
                If Range("g" & Plg) = "" Then
                Range("g" & Plg) = Int((12 * Rnd) + 1)
                Cel.Clear.contents : 
                End If
            Next Cel
         End If
    '******
        i = Range("c35").End(xlDown).Row
    For i = i To 56
        Range("a40") = Range("c" & i)
        Plg = [MATCH(a40,k6:k34,0)] + 5
        If Range("j" & Plg) = "" Then
            Range("j" & Plg) = Int((12 * Rnd) + 1)
            Range("c" & i).Clear.contents
        End If
    Next i
        i = Range("c35").End(xlDown).Row
    For i = i To 56
        Range("a40") = Range("c" & i)
        Plg = [MATCH(a40,n8:n32,0)] + 7
        If Range("m" & Plg) = "" Then
            Range("m" & Plg) = Int((12 * Rnd) + 1)
        End If
    Next i
        Range("a40") = WorksheetFunction.Max(Range("q12"), Range("q28"))
        Range("p" & [MATCH(a40,q12:q28,0)] + 11) = Int((12 * Rnd) + 1)

    On Error GoTo 0
    Range("a25").Copy Destination:=Range("a40:c56")
    Range("a40:c56").Locked = True
Call ImageFormule '####
End Sub

Le Bug est repéré à la ligne Cel.Clear.contents.

Merci d'avance

Amicalement

Noel

Bonjour,

Cette instruction n'existe pas !

Clear.contents

étonnant que çà ne bogue pas chez moi, çà s'écrit en un seul mot

Cel.ClearContents

Claude

Bonjour à tous,

Bonjour Claude,

Dans ton précédent message tu disais je cite :

"Cette instruction n'existe pas !" Clear.contents

Je suis tout à fait d'accord avec toi mais bien sure étant donné que ce code est dans le projet Pétanque, c'est que je n'ai pas osé le modifier mais surtout j'ai pas regardé le code . J'ai rectifié et ça fonctionne très bien.

Je te remercie beaucoup.

Amicalement

Noel

Rechercher des sujets similaires à "erreur compilation"