A
apache007
Dear experts,
I have the following macro to sort Cells.
--------------------------------------------------------
Sub Macro2()
'
' Macro2 Macro
'
' Keyboard Shortcut: Ctrl+x
'
Rows("4:385").Select
ActiveWorkbook.Worksheets("Aug").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Aug").Sort.SortFields.Add
Key:=Range("A4:A385"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("Aug").Sort.SortFields.Add
Key:=Range("B4:B385"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortTextAsNumbers
With ActiveWorkbook.Worksheets("Aug").Sort
.SetRange Range("A4:AD385")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
-------------------------------------
I would to change the constant "Aug" to the selected/active Sheet, so that I
wont have to change "Aug" all the time.
What should I change "Aug" to??
Thanks in advance.
I have the following macro to sort Cells.
--------------------------------------------------------
Sub Macro2()
'
' Macro2 Macro
'
' Keyboard Shortcut: Ctrl+x
'
Rows("4:385").Select
ActiveWorkbook.Worksheets("Aug").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Aug").Sort.SortFields.Add
Key:=Range("A4:A385"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("Aug").Sort.SortFields.Add
Key:=Range("B4:B385"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortTextAsNumbers
With ActiveWorkbook.Worksheets("Aug").Sort
.SetRange Range("A4:AD385")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
-------------------------------------
I would to change the constant "Aug" to the selected/active Sheet, so that I
wont have to change "Aug" all the time.
What should I change "Aug" to??
Thanks in advance.