Here's a VBA workaround
Sub SetLanguageFormat()
'Declarations
Dim cell As Range
Dim f As String
Const LCID As String = "[$-0409]"
Dim reg 'As RegExp 'Removed for late binding
'Setup regular expression
Set reg = CreateObject("vbscript.regexp")
reg.Global = True
reg.IgnoreCase = True
reg.Pattern = "\[\$\-+[\w]*[\w]\]"
'Loop through all cells and change the date formate
For Each cell In ActiveSheet.UsedRange.Cells
If IsDate(cell.Value) Then
f = cell.NumberFormat
If reg.Execute(f).Count 0 Then
'Language is set so replace it
f = reg.Replace(f, LCID)
Else
'Langauge is not set so add it
f = LCID & f
End If
cell.NumberFormat = f
End If
Next
End Sub
Let me know if this was useful.
Regards,
Jerry
|