Hey I am having trouble with this macro I recorded. I selected columns D through AK and then sorted by row 1. When I run the macro it dosnt sort by row 1. It just highlights the columns that I highlighted before.
Here is my code for the macro:
Sub Macro2()
'
' Macro2 Macro
'
'
Columns("D:AK").Select
ActiveWorkbook.Worksheets("ROW TEMPLATE (3)").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("ROW TEMPLATE (3)").Sort.SortFields.Add Key:=Range( _
"D1:AK1"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("ROW TEMPLATE (3)").Sort
.SetRange Range("D1:AK20")
.Header = xlGuess
.MatchCase = False
.Orientation = xlLeftToRight
.SortMethod = xlPinYin
.Apply
End With
End Sub
Here is my code for the macro:
Sub Macro2()
'
' Macro2 Macro
'
'
Columns("D:AK").Select
ActiveWorkbook.Worksheets("ROW TEMPLATE (3)").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("ROW TEMPLATE (3)").Sort.SortFields.Add Key:=Range( _
"D1:AK1"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("ROW TEMPLATE (3)").Sort
.SetRange Range("D1:AK20")
.Header = xlGuess
.MatchCase = False
.Orientation = xlLeftToRight
.SortMethod = xlPinYin
.Apply
End With
End Sub