andreafeliz
New Member
- Joined
- Jul 13, 2016
- Messages
- 6
I want to run this macro for each tab. It sorts the same range A5:H48 on each tab. It is sorted by date range oldest to newest in column A.
Help! Thank you.
Sub LoopTabSort()
'
' LoopTabSort Macro
' Sorts same range A5:H48 on each tab. Cell sorted by date range oldest to newest in column A
'
' Keyboard Shortcut: Ctrl+j
'
ActiveCell.Range("A1:H44").Select
ActiveWorkbook.Worksheets("Adams #1").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Adams #1").Sort.SortFields.Add Key:=ActiveCell, _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortTextAsNumbers
With ActiveWorkbook.Worksheets("Adams #1").Sort
.SetRange ActiveCell.Range("A1:H44")
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
ActiveWindow.SmallScroll Down:=-42
End Sub
Help! Thank you.
Sub LoopTabSort()
'
' LoopTabSort Macro
' Sorts same range A5:H48 on each tab. Cell sorted by date range oldest to newest in column A
'
' Keyboard Shortcut: Ctrl+j
'
ActiveCell.Range("A1:H44").Select
ActiveWorkbook.Worksheets("Adams #1").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Adams #1").Sort.SortFields.Add Key:=ActiveCell, _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortTextAsNumbers
With ActiveWorkbook.Worksheets("Adams #1").Sort
.SetRange ActiveCell.Range("A1:H44")
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
ActiveWindow.SmallScroll Down:=-42
End Sub