It works on
the currently selected range:
Sub blah()
For Each cll In Selection.Cells
a = Application.WorksheetFunction.Trim(cll.Value)
DateBits = Split(a, " ")
If UBound(DateBits) = 2 Then 'only a very basic checking that there
are two spaces in the trimmed date string
DateBits(0) = Format(DateBits(0), "0#") ' comment out to return single
digit day of month
DateBits(1) = (InStr("JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC", _
UCase(DateBits(1))) + 2) / 3 'month in year as number
DateBits(1) = Format(DateBits(1), "0#") 'comment out to return single
digit month
cll.Value = DateBits(2) & "-" & DateBits(1) & "-" & DateBits(0)
End If
Next cll
End Sub
There'll be some line wrapping above so unwrap them as required.
See also comments in the code.