Hi All,
I was hoping some one could help me out with a Macro or some VBA to solve this problem, here are the criteria:
1: Need to automatically sort row data with a common date by the value in Column G in ascending order (A-Z).
2: Row data is updated and added to everyday
3: Sort needs to be performed on Save (BeforeSave Event)
As an example, when I record a Macro to sort the 2-Oct row data in the attached workbook, I get this:
Sub Macro2()
'
' Macro2 Macro
' Autosort2
'
'
Range("A16:I23").Select
Selection.AutoFill Destination:=Range("A16:I47"), Type:=xlFillDefault
Range("A16:I47").Select
ActiveWorkbook.Worksheets("BeforeData").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("BeforeData").Sort.SortFields.Add Key:=Range( _
"G16:G47"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("BeforeData").Sort
.SetRange Range("A16:I47")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
Obviously when I would run this macro it would only select and sort the data in the range i've manually selected, however I need the worksheet to perform that action automatically when the user saves the workbook. The common group it has to sort by is whatever date is inputed by the user in the date column, which will be added to everyday, sometime with multiple dates per day.
Ive attached a book with a before and after example.
Thanks for your help!
Bookmarks