Thread: [Solved] Format as eg "17th January"
View Single Post
 
Old 01-10-2013, 04:14 AM
JohnWilson JohnWilson is offline Windows 7 64bit Office 2010 32bit
Programmer
 
Join Date: Nov 2008
Location: UK
Posts: 1,913
JohnWilson has a spectacular aura aboutJohnWilson has a spectacular aura about
Default

Are you in Excel (This is the PowerPoint section!)

Maybe:

Sub getdate()
Dim myDate As Date
myDate = ActiveSheet.Range("A1")
ActiveSheet.Range("A1") = getDay(Day(myDate)) & " " & MonthName(Month(myDate))
End Sub

Function getDay(dayNum As Long) As String
Select Case dayNum
Case Is = 1, 21, 31
getDay = dayNum & "st"
Case Is = 2, 22
getDay = dayNum & "nd"
Case Is = 3, 23
getDay = dayNum & "rd"
Case 4 To 30
getDay = dayNum & "th"
End Select
End Function
__________________
Microsoft PowerPoint MVP 2007-2023
Free Advanced PowerPoint Tips and Tutorials
Reply With Quote