Jack in the UK
Well-known Member
- Joined
- Feb 16, 2002
- Messages
- 3,215
Hi all as a pal gave some code away i promised i would so this will sort dates i hope superscript... yes this has been about
>>>>>>>>>>>>>>>>
Sub Con_Date_Superscript_()
Dim Newdate As String
Dim day
Dim rg As Range
Dim JACK_Cell As Range
Dim JACK_Rd As Range
Set JACK_Rd = Selection
For Each JACK_Cell In JACK_Rd
If IsDate(JACK_Cell) Then
Newdate = Format(JACK_Cell, "dd mmmm yyyy")
day = (Left(Newdate, 2))
Select Case day
Case 1 '1st
Newdate = day & "st " & Format(Newdate, "mmmm yyyy")
Case 2 '2nd
Newdate = day & "nd " & Format(Newdate, "mmmm yyyy")
Case 3 '3rd
Newdate = day & "rd " & Format(Newdate, "mmmm yyyy")
For Each JACK_Cell In JACK_Rd
JACK_Cell = Newdate
With JACK_Cell.Characters(Start:=2, Length:=2).Font
.SuperScript = True
End With
'End If
Next
End
Case 21 '1st
Newdate = day & "st " & Format(Newdate, "d dddd mmmm yyyy")
Case 22 '2nd
Newdate = day & "nd " & Format(Newdate, "d dddd mmmm yyyy")
Case 23 '3rd
Newdate = day & "rd " & Format(Newdate, "d dddd mmmm yyyy")
Case 31 '1st
Case 4 To 20, 24 To 30 '9th to 30th
Newdate = day & "th " & Format(Newdate, "d dddd mmmm yyyy")
End Select
JACK_Cell = Newdate
With JACK_Cell.Characters(Start:=3, Length:=2).Font
.SuperScript = True
End With
End If
Next
End Sub
>>>>>>>>>>>>>>>>
Sub Con_Date_Superscript_()
Dim Newdate As String
Dim day
Dim rg As Range
Dim JACK_Cell As Range
Dim JACK_Rd As Range
Set JACK_Rd = Selection
For Each JACK_Cell In JACK_Rd
If IsDate(JACK_Cell) Then
Newdate = Format(JACK_Cell, "dd mmmm yyyy")
day = (Left(Newdate, 2))
Select Case day
Case 1 '1st
Newdate = day & "st " & Format(Newdate, "mmmm yyyy")
Case 2 '2nd
Newdate = day & "nd " & Format(Newdate, "mmmm yyyy")
Case 3 '3rd
Newdate = day & "rd " & Format(Newdate, "mmmm yyyy")
For Each JACK_Cell In JACK_Rd
JACK_Cell = Newdate
With JACK_Cell.Characters(Start:=2, Length:=2).Font
.SuperScript = True
End With
'End If
Next
End
Case 21 '1st
Newdate = day & "st " & Format(Newdate, "d dddd mmmm yyyy")
Case 22 '2nd
Newdate = day & "nd " & Format(Newdate, "d dddd mmmm yyyy")
Case 23 '3rd
Newdate = day & "rd " & Format(Newdate, "d dddd mmmm yyyy")
Case 31 '1st
Case 4 To 20, 24 To 30 '9th to 30th
Newdate = day & "th " & Format(Newdate, "d dddd mmmm yyyy")
End Select
JACK_Cell = Newdate
With JACK_Cell.Characters(Start:=3, Length:=2).Font
.SuperScript = True
End With
End If
Next
End Sub