Hi
Thanks for your reply. I am trying to run the following macro, only the
first sort process works when the first worksheet change takes place, the
second sort process only works for subsequent changes.
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
'First sort process
Range("Data1").Sort Key1:=Range("P18"), Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=M, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
'Second sort depedent on first sort process
rs = Application.WorksheetFunction.CountA(Range("B:B")) + 15
cs = Application.WorksheetFunction.CountA(Range("15:15")) + 1
nb = Application.WorksheetFunction.CountBlank(Range("P18

" & rs))
nf = Application.WorksheetFunction.CountIf(Range("P18

" & rs), "FIN")
sr = rs + 1 - nb - nf
Range(Cells(sr, 1), Cells(rs, cs)).Select
Selection.Sort Key1:=Cells(sr, cs - 1), Order1:=xlAscending,
Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Application.Calculate
ActiveWorkbook.RefreshAll
Application.EnableEvents = True
End Sub