Sub format_data()
Dim strtemp
Dim arr
If InStr(selection.Text, ",") > 0 And InStr(selection.Text, "-") > 0 Then
strtemp = Replace(Replace(selection.Text, ",", ""), "-", ChrW(8211))
End If
If InStr(selection.Text, ",") = 0 And InStr(selection.Text, "-") > 0 Then
strtemp = Replace(selection.Text, "-", ChrW(8211))
End If
If InStr(selection.Text, ",") > 0 And InStr(selection.Text, "-") = 0 Then
strtemp = Replace(selection.Text, ",", "")
End If
If InStr(selection.Text, ",") = 0 And InStr(selection.Text, "-") = 0 Then
strtemp = selection.Text
End If
arr = Split(strtemp, " ")
If IsNumeric(Left(arr(0), 1)) = True Then
Select Case Left(arr(1), 3)
Case "Jan"
arr(1) = "January"
Case "Feb"
arr(1) = "February"
Case "Mar"
arr(1) = "March"
Case "Apr"
arr(1) = "April"
Case "May"
arr(1) = "May"
Case "Jun"
arr(1) = "June"
Case "Jul"
arr(1) = "July"
Case "Aug"
arr(1) = "August"
Case "Sep"
arr(1) = "September"
Case "Oct"
arr(1) = "October"
Case "Nov"
arr(1) = "November"
Case "Dec"
arr(1) = "December"
End Select
selection.Text = arr(0) & " " & arr(1) & " " & arr(2)
Else
Select Case Left(arr(0), 3)
Case "Jan"
arr(0) = "January"
Case "Feb"
arr(0) = "February"
Case "Mar"
arr(0) = "March"
Case "Apr"
arr(0) = "April"
Case "May"
arr(0) = "May"
Case "Jun"
arr(0) = "June"
Case "Jul"
arr(0) = "July"
Case "Aug"
arr(0) = "August"
Case "Sep"
arr(0) = "September"
Case "Oct"
arr(0) = "October"
Case "Nov"
arr(0) = "November"
Case "Dec"
arr(0) = "December"
End Select
selection.Text = arr(1) & " " & arr(0) & " " & arr(2)
End If
End Sub