1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
| Sub remplirnouvelledt()
Dim tableau() As String
Dim tableaupilote() As String
Dim derligsem As Integer
Dim x As Range
'nomClass = Nomclasseur 'récupère le nom du fichier
derligsem = ThisWorkbook.Sheets(numSEm).UsedRange.Rows.Count
derLig = ThisWorkbook.Sheets("participants").UsedRange.Rows.Count
'regarde si il n'y a rien sur cette ligne / voir si utile
For l = 13 To derligsem
If ThisWorkbook.Sheets(numSEm).Cells(l, 3) <> "" And ThisWorkbook.Sheets(numSEm).Cells(l, 7) = "" Then
ThisWorkbook.Sheets(numSEm).Cells(l, 7) = 1
lign = l
Exit For
End If
Next l
'statusbar
DTencours = ThisWorkbook.Sheets(numSEm).Cells(l, 3)
Application.StatusBar = "DT n=°" & DTencours & " en cours"
'rempli objet DT
ThisWorkbook.Sheets(numSEm).Cells(lign, 6) = Workbooks(nomClass).Sheets(1).Cells(19, 1)
'sépare nom et prénom du pilote
Dim userpilote As String
Dim userpilote1 As String
userpilote = Workbooks(nomClass).Sheets(1).Cells(6, 3)
userpilote1 = Right(userpilote, 7)
ThisWorkbook.Sheets(numSEm).Cells(lign, 4) = Left(userpilote, Len(userpilote) - 9)
ThisWorkbook.Sheets(numSEm).Cells(lign, 5) = userpilote1
lign = lign + 1
'idem pour acteurs
Dim user0 As String
Dim user1 As String
Dim colo As Integer
Dim ligne As Integer
Dim a As Integer
' a pour rattraper entre colonne droite et gauche, il n'y a pas le meme nombre a soustraire pour retomber sur le nom
a = 4
For colo = 9 To 21 Step 12
If colo = 21 Then a = 6
For ligne = 52 To 57
user0 = Workbooks(nomClass).Sheets(1).Cells(ligne, colo)
user1 = Workbooks(nomClass).Sheets(1).Cells(ligne, colo - a)
ThisWorkbook.Sheets(numSEm).Cells(lign, 4) = user1
ThisWorkbook.Sheets(numSEm).Cells(lign, 5) = user0
lign = lign + 1
Next ligne
Next colo
Application.DisplayAlerts = False
'Ferme le classeur
Workbooks(nomClass).Close
'Restaure l'affichage des Alertes
Application.DisplayAlerts = True
End Sub |
Partager