|
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Columns.Count > 1 Then Exit Sub
Dim Arr(1 To 9999, 1 To 1), Ms As Object, j%, C
With CreateObject("vbscript.regexp")
.Pattern = "[0-9,]+.[0-9]+(?=元)"
.Global = True
For Each C In Target
j = j + 1
Arr(j, 1) = C.Text
Set Ms = .Execute(Arr(j, 1))
For i = Ms.Count - 1 To 0 Step -1
Arr(j, 1) = Application.Replace(Arr(j, 1), Ms(i).FirstIndex + 1, Ms(i).Length, Format(Ms(i) / 10000, "#,##0.00万"))
Next i
Next C
End With
Target(1).Offset(0, 1).Resize(j) = Arr
End Sub
|
|