Bonjour,
J'ai réalisé le code suivant qui me permet de mettre en place un filtre en fonction de plusieurs critères.
Néanmoins j'ai deux problèmes lors de la mise en place du filtre:
- Ce dernier effectue un changement de hauteur de ligne (certaines lignes étant plus hautes que d'autres), et ainsi certaines lignes deviennent très peu hautes alors que d'autres prennent la hauteur de la ligne qui était là avant...
- L'autre soucis étant que, lorsque j'exécute ma macro, celle-ci sélectionne certaines cellules qui normalement font appel à un Msgbox. Le Msgbox apparaît donc comme un pop-up et Application.Displayalerts ne suffit pas pour l'arrêter.
Merci beaucoup de votre aide
J'ai réalisé le code suivant qui me permet de mettre en place un filtre en fonction de plusieurs critères.
Néanmoins j'ai deux problèmes lors de la mise en place du filtre:
- Ce dernier effectue un changement de hauteur de ligne (certaines lignes étant plus hautes que d'autres), et ainsi certaines lignes deviennent très peu hautes alors que d'autres prennent la hauteur de la ligne qui était là avant...
- L'autre soucis étant que, lorsque j'exécute ma macro, celle-ci sélectionne certaines cellules qui normalement font appel à un Msgbox. Le Msgbox apparaît donc comme un pop-up et Application.Displayalerts ne suffit pas pour l'arrêter.
Merci beaucoup de votre aide
Code:
Private Sub Workbook_Open()
Application.DisplayAlerts = False
Sheets("Vins").Select
ActiveWorkbook.Worksheets("Vins").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Vins").AutoFilter.Sort.SortFields.Add(Range("T6:T38" _
), xlSortOnCellColor, xlAscending, , xlSortNormal).SortOnValue.Color = RGB(255 _
, 255, 255)
ActiveWorkbook.Worksheets("Vins").AutoFilter.Sort.SortFields.Add(Range("T6:T38" _
), xlSortOnCellColor, xlAscending, , xlSortNormal).SortOnValue.Color = RGB(253 _
, 82, 87)
ActiveWorkbook.Worksheets("Vins").AutoFilter.Sort.SortFields.Add(Range("T6:T38" _
), xlSortOnCellColor, xlAscending, , xlSortNormal).SortOnValue.Color = RGB(250 _
, 164, 71)
ActiveWorkbook.Worksheets("Vins").AutoFilter.Sort.SortFields.Add(Range("T6:T38" _
), xlSortOnCellColor, xlAscending, , xlSortNormal).SortOnValue.Color = RGB(128 _
, 255, 129)
ActiveWorkbook.Worksheets("Vins").AutoFilter.Sort.SortFields.Add(Range("T6:T38" _
), xlSortOnCellColor, xlAscending, , xlSortNormal).SortOnValue.Color = RGB(226 _
, 255, 139)
ActiveWorkbook.Worksheets("Vins").AutoFilter.Sort.SortFields.Add(Range("T6:T38" _
), xlSortOnCellColor, xlAscending, , xlSortNormal).SortOnValue.Color = RGB(247 _
, 255, 178)
ActiveWorkbook.Worksheets("Vins").AutoFilter.Sort.SortFields.Add(Range("B6:B38" _
), xlSortOnCellColor, xlAscending, , xlSortNormal).SortOnValue.Color = RGB(255 _
, 255, 255)
ActiveWorkbook.Worksheets("Vins").AutoFilter.Sort.SortFields.Add(Range("B6:B38" _
), xlSortOnCellColor, xlAscending, , xlSortNormal).SortOnValue.Color = RGB(208 _
, 54, 99)
ActiveWorkbook.Worksheets("Vins").AutoFilter.Sort.SortFields.Add(Range("B6:B38" _
), xlSortOnCellColor, xlAscending, , xlSortNormal).SortOnValue.Color = RGB(255 _
, 236, 143)
ActiveWorkbook.Worksheets("Vins").AutoFilter.Sort.SortFields.Add(Range("B6:B38" _
), xlSortOnCellColor, xlAscending, , xlSortNormal).SortOnValue.Color = RGB(255 _
, 199, 206)
ActiveWorkbook.Worksheets("Vins").AutoFilter.Sort.SortFields.Add(Range("B6:B38" _
), xlSortOnCellColor, xlAscending, , xlSortNormal).SortOnValue.Color = RGB(255 _
, 232, 137)
ActiveWorkbook.Worksheets("Vins").AutoFilter.Sort.SortFields.Add(Range("B6:B38" _
), xlSortOnCellColor, xlAscending, , xlSortNormal).SortOnValue.Color = RGB(255 _
, 199, 206)
ActiveWorkbook.Worksheets("Vins").AutoFilter.Sort.SortFields.Add Key:=Range( _
"J6:J38"), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("Vins").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Application.DisplayAlerts = True
Sheets("Présentation").Select
Sheets("Listing appellations").Visible = False
End Sub