Saher Naji
Board Regular
- Joined
- Dec 19, 2019
- Messages
- 76
- Office Version
- 2013
- Platform
- Windows
Hello,
I'm trying to sort the date in an excel sheet, I want to click on a button to do this, but button is not at the same sheet
I assigned the macro in a button in the same sheet, it worked very well, but when I moved the button to another sheet it's not working!
what should I edit in this code?
I also attached a screen-shot, maybe there is a formula instead of the this VBA code, or make the VBA code run without click on any buttons
I don't have Office 365, so =FILTER functions is not working
Thanks a lot
I'm trying to sort the date in an excel sheet, I want to click on a button to do this, but button is not at the same sheet
I assigned the macro in a button in the same sheet, it worked very well, but when I moved the button to another sheet it's not working!
what should I edit in this code?
I also attached a screen-shot, maybe there is a formula instead of the this VBA code, or make the VBA code run without click on any buttons
I don't have Office 365, so =FILTER functions is not working
Thanks a lot
VBA Code:
Sub SortCC()
'
' SortCC Macro
'
'
Sheets("Jan_List").Select
Range("K2:R4").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Selection.End(xlUp).Select
Range("T2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
ActiveWorkbook.Worksheets("Jan_List").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Jan_List").Sort.SortFields.Add2 Key:=Range( _
"T2:T1241"), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("Jan_List").Sort
.SetRange Range("T2:AA1241")
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub