|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
'再猜一个:
'纯看图写代码,按子件描述来瞎掰。觉得你这描述有问题,最终变成了一个文字题。
Option Explicit
Sub test()
Dim arr, i, j, t, s, n, dic
Set dic = CreateObject("scripting.dictionary")
arr = [a1].CurrentRegion
For i = 2 To UBound(arr, 1)
If InStr(arr(i, 4), "/") Then
t = Split(arr(i, 4), "/")
If InStr(t(UBound(t)), "+") Then
t = Replace(arr(i, 4), t(UBound(t)), vbNullString)
dic(t) = vbNullString
End If
End If
Next
n = 1
For i = 2 To UBound(arr, 1)
If InStr(arr(i, 4), "/") Then
t = Split(arr(i, 4), "/"): s = t(UBound(t))
t = Replace(arr(i, 4), s, vbNullString)
If dic.exists(t) Then
If InStr(s, "+") Then
n = n + 1
For j = 1 To UBound(arr, 2): arr(n, j) = arr(i, j): Next
End If
Else
n = n + 1
For j = 1 To UBound(arr, 2): arr(n, j) = arr(i, j): Next
End If
Else
n = n + 1
For j = 1 To UBound(arr, 2): arr(n, j) = arr(i, j): Next
End If
Next
With [a1]
.Resize(UBound(arr, 1), UBound(arr, 2)).ClearContents
.Resize(n, UBound(arr, 2)) = arr
End With
End Sub |
评分
-
1
查看全部评分
-
|