|  

» Sort by birthday using VBA in Microsoft Excel

Question:
How can I sort a sheet with names by birthdays without considering the year in the birthday?


Answer:
Place the code below into the standard module.







Sub Sort()
Dim intRow As Integer
Application.DisplayAlerts = False
intRow = Cells(Rows.Count, 1).End(xlUp).Row
Range("C1").FormulaR1C1 = "=TEXT(RC[-1],""MM.TT"")"
Range("C1:C" & intRow).FillDown
Range("A1").CurrentRegion.Sort _
key1:=Range("C1"), order1:=xlAscending, _
key2:=Range("A1"), order2:=xlAscending, _
header:=xlNo
Columns("C").Delete
Application.DisplayAlerts = True
End Sub



Rate This Tip
12 34 5
Rating: 2.78     Views: 14454
No comments have been submitted.
Click here to post comment
For Registered Users
Name
Comment Title
Comments