|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub TEST()
Dim arr, s$, R&
arr = [a1].CurrentRegion
For i = 2 To UBound(arr)
If Len(Trim(Mid(arr(i, 1), 1, 4))) = 4 Then
s = arr(i, 1)
arr(i, 1) = s: R = 0
ElseIf Len(Trim(Mid(arr(i, 1), 1, 4))) = 2 Then
R = R + 1
arr(i, 1) = s & "." & Format(R, "000")
n = s & "." & Format(R, "000"): m = 0
End If
If Trim(Mid(arr(i, 1), 1, 6)) = "" Then
m = m + 1
arr(i, 1) = n & "." & Format(m, "000")
End If
Next i
[D1].Resize(UBound(arr)).NumberFormatLocal = "@"
[D1].Resize(UBound(arr)) = arr
End Sub |
|