satish gubbi
03-01-2013, 05:31 AM
Hi
I have below code, which I expect to sort all the sheets in a workbook, however its not working in all worksheets.
Please help me in rectifying this code.
Sub Sorty()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
With Range("E1").Select
Range("A:Z").Sort Key1:=Range("E2"), Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End With
On Error Resume Next
Next ws
End Sub
I have below code, which I expect to sort all the sheets in a workbook, however its not working in all worksheets.
Please help me in rectifying this code.
Sub Sorty()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
With Range("E1").Select
Range("A:Z").Sort Key1:=Range("E2"), Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End With
On Error Resume Next
Next ws
End Sub