adkheir
XLDnaute Occasionnel
bonjour
puis je me permettre de vous demander de m'aider a faire un reset un cette macro .
Merci
Sub remplitSalles()
Dim c As Range
Dim d As Range
Dim e As Range
MaxRow = [B65536].End(xlUp).Row 'colonne B,les créneaux
MaxCol = [IV2].End(xlToLeft).Column 'ligne2, les salles
Matière = 0
For Each c In Range([C3], Cells(MaxRow, MaxCol))
re: Matière = Matière + 1: If Matière > [Matières].Count Then Matière = 1
If c.Row > 3 Then
Sheets("Feuil3").Activate
Set e = Range(Cells(3, c.Column), c).Find(What:=Range("Matières").Cells(Matière).Value, LookIn:=xlFormulas, LookAt:=xlPart)
End If
If Not e Is Nothing Then GoTo re
[filtre].AutoFilter Field:=3, Criteria1:=[Matières].Cells(Matière)
Set d = [filtre].Offset(1, 0)
Do While d.EntireRow.Hidden = True
Set d = d(2, 1)
Loop
c = d & vbLf & d(1, -1) & "+" & vbLf & d(2, -1)
d(1, 0) = d(1, 0) + 1
d(2, 0) = d(2, 0) + 1
[filtre].AutoFilter Field:=3
[filtre].Sort Key1:=Sheets("Data").[C2], Order1:=xlAscending, Key2:=Sheets("Data").[B2], Order2:=xlAscending, Header:=xlGuess
Set e = Nothing
Next
Range([C3], Cells(MaxRow, MaxCol)).EntireColumn.AutoFit
End Sub
puis je me permettre de vous demander de m'aider a faire un reset un cette macro .
Merci
Sub remplitSalles()
Dim c As Range
Dim d As Range
Dim e As Range
MaxRow = [B65536].End(xlUp).Row 'colonne B,les créneaux
MaxCol = [IV2].End(xlToLeft).Column 'ligne2, les salles
Matière = 0
For Each c In Range([C3], Cells(MaxRow, MaxCol))
re: Matière = Matière + 1: If Matière > [Matières].Count Then Matière = 1
If c.Row > 3 Then
Sheets("Feuil3").Activate
Set e = Range(Cells(3, c.Column), c).Find(What:=Range("Matières").Cells(Matière).Value, LookIn:=xlFormulas, LookAt:=xlPart)
End If
If Not e Is Nothing Then GoTo re
[filtre].AutoFilter Field:=3, Criteria1:=[Matières].Cells(Matière)
Set d = [filtre].Offset(1, 0)
Do While d.EntireRow.Hidden = True
Set d = d(2, 1)
Loop
c = d & vbLf & d(1, -1) & "+" & vbLf & d(2, -1)
d(1, 0) = d(1, 0) + 1
d(2, 0) = d(2, 0) + 1
[filtre].AutoFilter Field:=3
[filtre].Sort Key1:=Sheets("Data").[C2], Order1:=xlAscending, Key2:=Sheets("Data").[B2], Order2:=xlAscending, Header:=xlGuess
Set e = Nothing
Next
Range([C3], Cells(MaxRow, MaxCol)).EntireColumn.AutoFit
End Sub
Dernière édition: