|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub 按钮1_Click()
r = Cells(Rows.Count, 6).End(3).Row
arr = [a1].CurrentRegion
brr = WorksheetFunction.Transpose(Range("f2:f" & r))
For j = 1 To UBound(brr)
For i = j + 1 To UBound(brr)
If Len(brr(j)) < Len(brr(i)) Then
tm = brr(j)
brr(j) = brr(i)
brr(i) = tm
End If
Next i
Next j
With CreateObject("vbscript.regexp")
.Pattern = Join(brr, "|")
For j = 2 To UBound(arr)
If .test(arr(j, 1)) Then arr(j, 1) = .Execute(arr(j, 1))(0)
Next j
[k1].Resize(UBound(arr)) = arr
End With
End Sub |
评分
-
1
查看全部评分
-
|