![]() |
|
#1
|
|||
|
|||
![]()
Hi
I'm using an excel macro to format dates I need to format as eg "17th January" or "2nd March" type format Please help Many thanks |
#2
|
|||
|
|||
![]()
AFAIK Andy there's no built in way.
Try: Sub getdate() MsgBox getDay(Day(Now)) & " " & MonthName(Month(Now)) 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 |
#3
|
|||
|
|||
![]()
Many thanks
If I have my dates (eg 01/01/2012) in cell A1, how do i modify? Cheers |
#4
|
|||
|
|||
![]()
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 |
#5
|
|||
|
|||
![]()
This works a treat thank you!
Sorry...yes I appear to be in the wrong forum Have a good day |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to edit the "Format" and the "show level" of an EXISTING table of content? | Jamal NUMAN | Word | 2 | 08-14-2011 10:46 AM |
![]() |
Jamal NUMAN | Word | 2 | 07-08-2011 02:24 AM |
![]() |
Jamal NUMAN | Word | 2 | 07-03-2011 03:11 AM |
![]() |
Jamal NUMAN | Word | 5 | 06-15-2011 10:14 AM |
![]() |
Cara | Drawing and Graphics | 2 | 05-20-2011 10:13 AM |