|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- Sub test()
- Dim arr, i
- j = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
- Range("A2:R" & j).Sort key1:=[A2], key2:=[C2], key3:=[P2], Header:=xlYes
- arr = Range("A2:R" & j)
- For i = 3 To UBound(arr)
- If arr(i, 5) = "" And arr(i, 16) <> "" Then
- If arr(i, 1) = arr(i - 1, 1) And arr(i, 3) = arr(i - 1, 3) And arr(i, 16) = arr(i - 1, 16) And _
- arr(i, 6) = arr(i - 1, 6) + 1 And (arr(i, 4) = 261 And arr(i - 1, 4) = 101 Or arr(i, 4) = 531 And arr(i - 1, 4) = 261) Then
- If Len(arr(i, 2)) = 10 Then
- arr(i, 18) = arr(i, 2) & "开料" & arr(i - 1, 2)
- Else
- arr(i, 18) = arr(i - 1, 2) & "开料" & arr(i, 2)
- End If
- arr(i - 1, 18) = arr(i, 18)
- End If
- End If
- Next
- Range("A2:R" & j) = arr
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|