Problème code

jacky49

XLDnaute Impliqué
Bonsoir le forum,

j'ai ce code ci-dessous qui me trie ce que je veux mais j'ai ajouté LastLigne pour masquer les lignes vide derrière la dernière ligne rempli mais il me met une erreur sur cette ligne
merci d'avance

Code:
 .SetRange Range("B4:M900"lastLine)

Code:
Sub TrierParClub()
Application.ScreenUpdating = False
  Dim lastLine As Long
    lastLine = Range("B" & Rows.Count).End(xlUp).Row
    ActiveWorkbook.Worksheets("Inscriptions").Sort.SortFields.Clear
    ActiveWorkbook.Worksheets("Inscriptions").Sort.SortFields.Add Key:=Range( _
        "D5:D1100"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
        xlSortNormal
    ActiveWorkbook.Worksheets("Inscriptions").Sort.SortFields.Add Key:=Range( _
        "K5:K1100"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
        xlSortNormal
    With ActiveWorkbook.Worksheets("Inscriptions").Sort
        .SetRange Range("B4:M900"lastLine)
        .Header = xlYes
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With
    Range("D6").Select
Application.ScreenUpdating = True
End Sub
 

Statistiques des forums

Discussions
312 348
Messages
2 087 510
Membres
103 572
dernier inscrit
hamzahaha