Forum Discussion
Help with date sorting macro
- Jul 08, 2020
stephanieporter Please check the following video and following excel whether I understood correctly what you wanted to say.
And still if you have any query in VBA then you can also message me privately or on my mail id
And if you liked my answer please do mark my answer as best answer officially
stephanieporter Hey I have created a simpler Macro you can try this Macro
Sub Macro2()
'
' Macro2 Macro
'
'
Sheets("Sheet1").Select
Cells.Select
Selection.AutoFilter
ActiveWorkbook.Worksheets("Sheet1").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Sheet1").AutoFilter.Sort.SortFields.Add Key:=Range _
("A1:A1048576"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("Sheet1").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("A1").Select
Selection.AutoFilter
End Sub
I am also attaching the file you can check whether it is running
Ok so not sure it's working. The code thats currently in my work book (for column a to have date and time pickers in it) is:
Private Sub DTPicker1_CallbackKeyDown(ByVal KeyCode As Integer, ByVal Shift As Integer, ByVal CallbackField As String, CallbackDate As Date)
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
With Sheet1.DTPicker1
.Height = 20
.Width = 20
If Not Intersect(Target, Range("A115:A120,A122:A131")) Is Nothing Then
.Visible = True
.Top = Target.Top
.Left = Target.Offset(0, 1).Left
.LinkedCell = Target.Address
Else
.Visible = False
End If
End With
End Sub
I now need something to sort all the rows by date should we decide to change the date on something, I want it to automatically move all the content and align them in date order (if possible). There are 17 columns of information that all needs to stick together. Am I making sense? I can't post a copy of the work book as it's confidential information.
Thanks
- DevendraJainJul 08, 2020Iron Contributor
stephanieporter Please check the following video and following excel whether I understood correctly what you wanted to say.
And still if you have any query in VBA then you can also message me privately or on my mail id
And if you liked my answer please do mark my answer as best answer officially