|
Sub 加点()
Dim i, j, k, s, t, m
Dim irow
Dim arr
irow = Sheet1.[a65336].End(xlUp).Row
arr = Sheet1.Range("a1:c" & irow - 3)
Sheet1.Range("c2:c" & irow - 3).Clear
For i = 2 To irow - 3
t = Len(arr(i, 1))
If t <= 4 Then
Sheet1.Cells(i, 3) = arr(i, 1)
Else
If t <= 6 Then
Sheet1.Cells(i, 3) = Application.WorksheetFunction.Substitute(arr(i, 1), Left(arr(i, 1), 4), Left(arr(i, 1), 4) & ".")
Else
k = Int((t - 1) / 2) - 1
s = Application.WorksheetFunction.Substitute(arr(i, 1), Left(arr(i, 1), 4), Left(arr(i, 1), 4) & ".")
For m = 2 To k
s = Application.WorksheetFunction.Substitute(s, Left(s, 3 * m + 1), Left(s, 3 * m + 1) & ".")
Next
Sheet1.Cells(i, 3) = s
End If
End If
Next
End Sub |
|