» Sort by birthday using VBA in Microsoft Excel
CATEGORY - Date & Time in VBA
VERSION - All Microsoft Excel Versions
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
Book Store:
Recommended Books:
- Getting to Yes: Negotiating Agreement Without Giving In
- Excel Charts
- Financial Statements: A Step-By-Step Guide to Understanding and Creating Financial Reports
- Retire Young, Retire Rich
- Lower Your Taxes - Big Time! : Wealth-Building, Tax Reduction Secrets from an IRS Insider
- Your First Business Plan: A Simple Question and Answer Format Designed to Help You Write Your Own Plan (3rd Ed)
No comments have been submitted.

