Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Dim vchemin As String Dim vclasseurN1 As Worksheet Dim vclasseur As Worksheet Dim j As Integer, i As Integer 'tri donnée salarié Range("B4:AN15").Select ActiveWorkbook.Worksheets("données salariés").Sort.SortFields.Clear ActiveWorkbook.Worksheets("données salariés").Sort.SortFields.Add Key:=Range( _ "B4:B15"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _ xlSortNormal ActiveWorkbook.Worksheets("données salariés").Sort.SortFields.Add Key:=Range( _ "C4:C15"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _ xlSortNormal With ActiveWorkbook.Worksheets("données salariés").Sort .SetRange Range("B3:AN15") .Header = xlYes .MatchCase = False .Orientation = xlTopToBottom .SortMethod = xlPinYin .Apply End With 'effacer contenu feuil1 Sheets("Feuil1").Select Range("A2:D23").Select Selection.ClearContents 'tri base de données chantiers vchemin = "C:\Documents and Settings\Sabine\Bureau\Sandie\Suivi des salariés" Set vclasseurN1 = Workbooks("nouveaux-clients.xls").Worksheets("Feuil1") Set vclasseur = Workbooks("base de données chantiers.xls").Worksheets("Feuil1") Columns("B:M").Select ActiveWorkbook.Worksheets("Feuil1").Sort.SortFields.Clear ActiveWorkbook.Worksheets("Feuil1").Sort.SortFields.Add Key:=Range("B2:B54") _ , SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal ActiveWorkbook.Worksheets("Feuil1").Sort.SortFields.Add Key:=Range("E2:E54") _ , SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal ActiveWorkbook.Worksheets("Feuil1").Sort.SortFields.Add Key:=Range("F2:F54") _ , SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal ActiveWorkbook.Worksheets("Feuil1").Sort.SortFields.Add Key:=Range("C2:C54") _ , SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal With ActiveWorkbook.Worksheets("Feuil1").Sort .SetRange Range("B1:M54") .Header = xlYes .MatchCase = False .Orientation = xlTopToBottom .SortMethod = xlPinYin .Apply End With ActiveWindow.ScrollColumn = 1 End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question