jacky49
XLDnaute Impliqué
Bonsoir le forum,
j'ai ce code qui me sert pour plusieurs feuilles
puis j'ai refais une macro (ClasserparTempsAgilité)qui fonctionne mais qui elle ne fonctionne que pour la feuille active, j'aimerais qu'il puisse servir comme l'autre pour toutes les feuilles.
voici le code de ma 2ème macro
merci d'avance pour ceux qui veulent bien m'aider
et bonne fête de fin d'année
jacky
j'ai ce code qui me sert pour plusieurs feuilles
Code:
Public Sub SERIESAVE(ByVal sht As Object, ByVal DebZone As Integer, ByVal ColDebBD As Integer)
Dim LastLig As Integer, DossParPoule As Integer, NbrPoules As Integer
Dim i As Integer, j As Integer, k As Integer, Deb As Integer
Dim c As Range
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
If sht.Range("P65536").End(xlUp).Row > 8 Then
MsgBox "Finale déjà enregistrée, impossible de modifier le résultat de la série"
Exit Sub
End If
CATEGORIE sht, ColDebBD
With sht
.Unprotect Password:="Roller"
.Columns("K:K").Hidden = False
LastLig = .Range("I65535").End(xlUp).Row
.Range("K9:L" & LastLig).ClearContents
LastLig = .Range("B65535").End(xlUp).Row
NbrPoules = Int(Cells(DebZone - 1, 256).End(xlToLeft).Column / 3)
Deb = 0
For j = 1 To NbrPoules
k = 0
DossParPoule = Cells(DebZone, 3 * j - 1).End(xlDown).Row
For i = DebZone To DossParPoule
Set c = .Range("B8:B" & LastLig).Find(Cells(i, 3 * j - 1), , xlValues, xlWhole)
If Not c Is Nothing Then
If IsNumeric(Cells(i, 3 * j).Value) Then
c.Offset(0, 9).Value = Cells(i, 3 * j).Value ' + Deb
Else
k = k + 1
c.Offset(0, 10).Value = "DNF"
End If
End If
Set c = Nothing
Next i
'Deb = Deb + DossParPoule - DebZone + 1 - k
.Range("B9:L" & LastLig).Sort Key1:=sht.Range("K9"), _
Order1:=xlAscending, Header:=xlNo, OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom, DataOption1:=xlSortNormal
Next j
.Activate
.Protect Password:="Roller"
End With
Call ClasserparTempsAgilité
End Sub
voici le code de ma 2ème macro
Code:
Sub ClasserparTempsAgilité()
'
' ClasserparTempsAgilité Macro
'
'
Range("B8:K14").Select
ActiveWorkbook.Worksheets("SMG").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("SMG").Sort.SortFields.Add Key:=Range("K9:K14"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("SMG").Sort.SortFields.Add Key:=Range("H9:H14"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("SMG").Sort
.SetRange Range("B8:K14")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("T8").Select
End Sub
et bonne fête de fin d'année
jacky