Saher Naji
Board Regular
- Joined
- Dec 19, 2019
- Messages
- 76
- Office Version
- 2013
- Platform
- Windows
Hello,
I have this very simple code
what I'm trying to do is make this code affect on 365 sheets, (not all of the workbook sheets) I have 30 sheets for each month,
I did not know how to edit this code,
I tried to add the sheets like this,
With ActiveWorkbook.Worksheets("Jan_1"+"Jan_2"+"Jan_3"+"Jan_4"+"Jan_5"+.... etc ).Sort
but it did not work
Thanks in advance
I have this very simple code
VBA Code:
Sub SortByTime()
'
' SortByTime Macro
' Sort by Time
'
' Keyboard Shortcut: Ctrl+Shift+M
'
Range("C4:J43").Select
ActiveWindow.SmallScroll Down:=-36
ActiveWorkbook.Worksheets("Jan_1").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Jan_1").Sort.SortFields.Add2 Key:=Range("G4:G43") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Jan_1").Sort
.SetRange Range("C3:J43")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
what I'm trying to do is make this code affect on 365 sheets, (not all of the workbook sheets) I have 30 sheets for each month,
I did not know how to edit this code,
I tried to add the sheets like this,
With ActiveWorkbook.Worksheets("Jan_1"+"Jan_2"+"Jan_3"+"Jan_4"+"Jan_5"+.... etc ).Sort
but it did not work
Thanks in advance