Forum Discussion
Joshua Cayetano
Oct 15, 2018Copper Contributor
Sort If Function List Results
I have a list of 200 names, with emails, year of graduation and enrollment date. I am trying to extract a list of emails depending on the YoG and ED. My current formula works (e.g. it only it shows t...
Lorenzo Kim
Oct 15, 2018Bronze Contributor
you have to sort it manually or with macro like below:
Sub SortColumnN()
mlrc = Cells(Rows.Count, "N").End(xlUp).Row
Range("N1:N" & mlrc).Select
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Add Key:=Range("N2:N" & mlrc) _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Sheet1").Sort
.SetRange Range("N2:N" & mlrc)
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub