Code qui BUG sur Excel 2007

jacky49

XLDnaute Impliqué
bonsoir le forum,
Voici un code qui me permet de faire des bordures et qui fonctionne sur EXCEL 2003 mais qui BUg sur EXCEL 2007 mais je ne sais pas pourquoi.
La ligne en jaune qui bug.
Merci
jacky


Code:
Public Sub CADRERPOULE(ByVal shtX As Object, ByVal Categ As String, ByVal Kol As Integer, ByVal Lig As Integer)
    
With shtX
    .Range(.Cells(Lig - 2, Kol + 2), .Cells(Lig - 1, Kol + 20)).ClearContents
    With .Range(.Cells(Lig - 2, Kol + 2), .Cells(Lig + 6, Kol + 20))
        .UnMerge
        '.ClearContents
        .Borders(xlEdgeLeft).LineStyle = xlNone
        .Borders(xlEdgeTop).LineStyle = xlNone
        .Borders(xlEdgeRight).LineStyle = xlNone
        .Borders(xlEdgeBottom).LineStyle = xlNone
        .Borders(xlInsideVertical).LineStyle = xlNone
        .Borders(xlInsideHorizontal).LineStyle = xlNone
    End With
        
        .Cells(Lig - 1, Kol).Value = "Dossard"
        .Cells(Lig - 1, Kol + 1).Value = "Arrivée"
        If UCase(.Name) = "FINALE" Then
            .Cells(Lig - 2, Kol).Value = "Finale " & Int((Kol + 1) / 3)
        Else
            .Cells(Lig - 2, Kol).Value = "Série " & (TOUR + 1) & "." & Int((Kol + 1) / 3)
        End If
        .Range(.Cells(Lig - 2, Kol), .Cells(Lig - 2, Kol + 1)).Merge
        If TOUR = 0 And Kol = 2 Then .Cells(Lig - 4, 1).Value = "Catégorie: " & Categ


    With .Range(.Cells(Lig - 2, Kol), .Cells(Lig - 1, Kol + 1))
        .Borders(xlEdgeLeft).LineStyle = xlDouble
        .Borders(xlEdgeRight).LineStyle = xlDouble
        .Borders(xlEdgeTop).LineStyle = xlDouble
        .Borders(xlEdgeBottom).LineStyle = xlDouble
        .Borders(xlInsideVertical).LineStyle = xlDouble
        .Borders(xlInsideHorizontal).LineStyle = xlDouble
    End With
    
    With .Range(.Cells(Lig, Kol), .Cells(Lig + 5, Kol + 1))
        [COLOR="Yellow"].Borders(xlEdgeLeft).LineStyle = xlDouble[/COLOR]
        .Borders(xlEdgeRight).LineStyle = xlDouble
        .Borders(xlEdgeTop).LineStyle = xlDouble
        .Borders(xlEdgeBottom).LineStyle = xlDouble
        .Borders(xlInsideVertical).LineStyle = xlDouble
        .Borders(xlInsideHorizontal).LineStyle = xlDash
    End With
    
End With
End Sub
 

JNP

XLDnaute Barbatruc
Re : Code qui BUG sur Excel 2007

Bonjour Jacky49 :),
J'ai testé ta macro sur 2007 avec
Code:
Sub test()
Dim Feuille As Worksheet
Set Feuille = Sheets("Feuil1")
Call CADRERPOULE(Feuille, "Test", 3, 3)
End Sub
aucun souci rencontré. Je pense que ton fichier est indispensable pour trouver l'erreur...
Bonne soirée :cool:
 

Discussions similaires

Statistiques des forums

Discussions
312 679
Messages
2 090 849
Membres
104 677
dernier inscrit
soufiane12