Sub Importation_Journée(Nom As String)
'
Dim NumeroJournee As Integer
Dim JoueursJournee As Integer
Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim NomJoueur As String
Dim NbreJoueursTotal As Integer
Dim ColonneJoueur As Integer
'
' Sélection de la feuille
Windows(Nom).Activate [COLOR="Red"][B]Ca merde ici !!!!!![/B][/COLOR]
' Rajout des deux calculs
Cells(4, 1).Select
ActiveCell.FormulaR1C1 = _
"=VALUE(IF(RIGHT(LEFT(R[-1]C,14))=""e"",RIGHT(LEFT(R[-1]C,13)),RIGHT(LEFT(R[-1]C,14),2)))"
Cells(7, 1).Select
ActiveCell.FormulaR1C1 = "=VALUE(LEFT(R[-1]C,2))"
NumeroJournee = Cells(4, 1).Value
JoueursJournee = Cells(7, 1).Value
Cells(4, 1).Value = ""
Cells(7, 1).Value = ""
' Suppression des bordures
Cells.Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
' Suppression du fusionnage
Selection.UnMerge
' Sélection des matchs de la journée
Range("B9:C18").Select
Selection.Copy
' Copie dans le classeur
Windows("Classeur L1 2008-2009").Activate
Cells(6 + 18 * (NumeroJournee - 1), 2).Select
ActiveSheet.Paste
' Sélection d'un joueur
For i = 1 To JoueursJournee
Windows("Nom").Activate
NomJoueur = Cells(8, 8 + 4 * (i - 1))
' Savoir si le joueur existe déjà ou pas
NbreJoueursTotal = Workbooks("Classeur L1 2008-2009").Worksheets("Feuil1").Range("B1").Value
k = 1
Do While k < NbreJoueursTotal + 1
If Workbooks("Classeur L1 2008-2009").Worksheets("Feuil1").Cells(4, 15 + 3 * (k - 1)).Value = NomJoueur Then
ColonneJoueur = 15 + 3 * (k - 1)
Exit Do
Else
k = k + 1
End If
Loop
' Copie du nom du joueur
If k = NbreJoueursTotal + 1 Then
ColonneJoueur = 15 + 3 * NbreJoueursTotal
Cells(8, 8 + 4 * (i - 1)).Select
Application.CutCopyMode = False
Selection.Copy
Windows("Classeur L1 2008-2009").Activate
Cells(4, ColonneJoueur).Select
ActiveSheet.Paste
' Fusionnage des cellules
Range(Cells(4, ColonneJoueur), Cells(4, ColonneJoueur + 2)).Select
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Merge
' Copie des votes du joueur
Windows("Nom").Activate
Range(Cells(9, 8 + 4 * (i - 1)), Cells(18, 9 + 4 * (i - 1))).Select
Selection.Copy
Windows("Classeur L1 2008-2009").Activate
Cells(6 + 18 * (NumeroJournee - 1), ColonneJoueur).Select
ActiveSheet.Paste
Else
Windows("Nom").Activate
Range(Cells(9, 8 + 4 * (JoueursJournee - 1)), Cells(18, 9 + 4 * JoueursJournee - 1)).Select
Selection.Copy
Windows("Classeur L1 2008-2009").Activate
Cells(6 + 18 * (NumeroJournee - 1), ColonneJoueur).Select
ActiveSheet.Paste
End If
Next i
End Sub