View Single Post
 
Old 08-26-2012, 01:04 AM
mth's Avatar
mth mth is offline Windows 7 32bit Office 2007
Novice
 
Join Date: Aug 2012
Location: France
Posts: 3
mth is on a distinguished road
Default

Hello,

May be try this:

Code:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Lig As Long, c As Long, Plage As Range
Lig = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row + 1
Set Plage = ActiveSheet.Range("E4:E" & Lig)
 
If Not Intersect(Target, Plage) Is Nothing And Target.Count = 1 Then
    With ActiveSheet
    Lig = .Cells(Rows.Count, 1).End(xlUp).Row
    Set Plage = ActiveSheet.Range("A4:E" & Lig)
    
        For c = 5 To 2 Step -1
            Plage.Sort _
                Key1:=.Range(.Cells(4, c), .Cells(Lig, c)), _
                Order1:=xlAscending, _
                Header:=xlGuess, _
                OrderCustom:=1, _
                MatchCase:=False, _
                Orientation:=xlTopToBottom
        Next c
    End With
End If
End Sub
m
Attached Files
File Type: xls Copie de MIST PATIENT LIST4.xls (69.0 KB, 10 views)
Reply With Quote