Sub SortMulArea()
With Worksheets("Standings").UsedRange
Set c = .Find("Code", LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
lr = c.CurrentRegion.Rows.Count - 1
lc = c.End(xlToRight).Column - c.Column + 1
Set sortrange = c.Resize(lr, lc)
ActiveWorkbook.Worksheets("Standings").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Standings").Sort.SortFields.Add Key:=sortrange.Columns(lr).Offset(1).Resize(lr - 1), _
SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Standings").Sort
.SetRange sortrange
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With
End Sub
vbklan said:PS- if the worksheet is protected, the password is 1
Sub SortMulArea()
With Worksheets("Standings").UsedRange
Set c = .Find("Code", LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
lr = c.CurrentRegion.Rows.Count - 1
lc = c.End(xlToRight).Column - c.Column + 1
Set sortrange = c.Resize(lr, lc)
With ActiveWorkbook.Worksheets("Standings").Sort
.SortFields.Clear
.SortFields.Add Key:=sortrange.Columns(lr).Offset(1).Resize(lr - 1), _
SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
.SortFields.Add Key:=sortrange.Columns(1).Offset(1).Resize(lr - 1), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
.SetRange sortrange
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With
End Sub
Wvklan said:Thank you sooo much
...And I know someone with far too much time on his hands.......Yes.. I know few other languages also..
Hindi, Bengali, Punjabi, and learning french also.